function social_core_form_taxonomy_vocabulary_confirm_delete_alter in Open Social 10.2.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_core/social_core.module \social_core_form_taxonomy_vocabulary_confirm_delete_alter()
- 8 modules/social_features/social_core/social_core.module \social_core_form_taxonomy_vocabulary_confirm_delete_alter()
- 8.2 modules/social_features/social_core/social_core.module \social_core_form_taxonomy_vocabulary_confirm_delete_alter()
- 8.3 modules/social_features/social_core/social_core.module \social_core_form_taxonomy_vocabulary_confirm_delete_alter()
- 8.4 modules/social_features/social_core/social_core.module \social_core_form_taxonomy_vocabulary_confirm_delete_alter()
- 8.5 modules/social_features/social_core/social_core.module \social_core_form_taxonomy_vocabulary_confirm_delete_alter()
- 8.6 modules/social_features/social_core/social_core.module \social_core_form_taxonomy_vocabulary_confirm_delete_alter()
- 8.7 modules/social_features/social_core/social_core.module \social_core_form_taxonomy_vocabulary_confirm_delete_alter()
- 8.8 modules/social_features/social_core/social_core.module \social_core_form_taxonomy_vocabulary_confirm_delete_alter()
- 10.3.x modules/social_features/social_core/social_core.module \social_core_form_taxonomy_vocabulary_confirm_delete_alter()
- 10.0.x modules/social_features/social_core/social_core.module \social_core_form_taxonomy_vocabulary_confirm_delete_alter()
- 10.1.x modules/social_features/social_core/social_core.module \social_core_form_taxonomy_vocabulary_confirm_delete_alter()
Implements hook_form_taxonomy_vocabulary_confirm_delete_alter().
File
- modules/
social_features/ social_core/ social_core.module, line 506 - The Social core module.
Code
function social_core_form_taxonomy_vocabulary_confirm_delete_alter(&$form, FormStateInterface $form_state, $form_id) {
// Fetch current user.
$account = \Drupal::currentUser();
// Check if the current use is the admin.
if (!in_array('administrator', $account
->getRoles())) {
// Remove the option to delete.
unset($form['actions']['submit']);
$form['description']['#markup'] = t('You have insufficient permissions to delete this vocabulary');
}
}