function taxonomy_access_fix_form_taxonomy_overview_terms_alter in Taxonomy access fix 7.2
Same name and namespace in other branches
- 8.3 taxonomy_access_fix.module \taxonomy_access_fix_form_taxonomy_overview_terms_alter()
- 8 taxonomy_access_fix.module \taxonomy_access_fix_form_taxonomy_overview_terms_alter()
- 8.2 taxonomy_access_fix.module \taxonomy_access_fix_form_taxonomy_overview_terms_alter()
- 7 taxonomy_access_fix.module \taxonomy_access_fix_form_taxonomy_overview_terms_alter()
Implements hook_form_FORM_ID_alter() for taxonomy_overview_terms().
See also
File
- ./
taxonomy_access_fix.module, line 64 - This file contains all hooks and callbacks for extra/improved Taxonomy permissions.
Code
function taxonomy_access_fix_form_taxonomy_overview_terms_alter(&$form, &$form_state) {
// Admin: don't fix anything.
if (user_access('administer taxonomy')) {
return;
}
// Wrong part of the form (ie. reset): bail out.
if (!isset($form['#vocabulary'])) {
return;
}
$vocabulary = $form['#vocabulary'];
$can_edit = user_access('edit terms in ' . $vocabulary->vid);
// Remove edit links.
if (!$can_edit) {
foreach (element_children($form) as $item) {
if (isset($form[$item]['#term'])) {
$form[$item]['edit']['#access'] = FALSE;
}
}
}
// Hide Save and Reset buttons.
if (!taxonomy_access_fix_access('reorder', $vocabulary)) {
$form['actions']['submit']['#access'] = $form['actions']['reset_alphabetical']['#access'] = FALSE;
}
}