Skip to content

Commit

Permalink
fix(YSP-446): hide single content sync
Browse files Browse the repository at this point in the history
Only show for user 1 at the moment.
  • Loading branch information
dblanken-yale committed Oct 30, 2024
1 parent 2eeecb3 commit db0f5c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion web/profiles/custom/yalesites_profile/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"drupal/section_library": "1.1.1",
"drupal/selective_better_exposed_filters": "3.0.3",
"drupal/simple_sitemap": "4.2.1",
"drupal/single_content_sync": "1.4.5",
"drupal/single_content_sync": "1.4.6",
"drupal/smart_date": "4.1.6",
"drupal/twig_tweak": "3.4.0",
"drupal/typogrify": "1.4-rc1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,3 +600,17 @@ function ys_core_form_views_exposed_form_alter(&$form, FormStateInterface $form_
}
}
}

/**
* Implements hook_menu_local_tasks_alter().
*
* If the current user is not user 1, remove the single content sync tab.
*/
function ys_core_menu_local_tasks_alter(&$data, $route_name, $cachability) {
foreach ($data['tabs'][0] as $key => $tab) {
if (strpos($key, 'single_content_sync') === 0 &&
\Drupal::currentUser()->id() != 1) {
unset($data['tabs'][0][$key]);
}
}
}

0 comments on commit db0f5c5

Please sign in to comment.