Skip to content

Instantly share code, notes, and snippets.

@gormus
Created June 22, 2016 20:41
Show Gist options
  • Select an option

  • Save gormus/43d7ab5b767c43e7ae44ccab508f0207 to your computer and use it in GitHub Desktop.

Select an option

Save gormus/43d7ab5b767c43e7ae44ccab508f0207 to your computer and use it in GitHub Desktop.
Improve taxonomy term add/edit form in Drupal 7.x
<?php
/**
* Implements hook_form_FORM_ID_alter().
*/
function abc_form_taxonomy_form_term_alter(&$form, &$form_state) {
// Move all fieldsets into vertical-tabs.
$form['additional_settings'] = array(
'#type' => 'vertical_tabs',
);
foreach ($form as $key => $value) {
if (
is_array($form[$key])
&& isset($form[$key]['#type'])
&& ($form[$key]['#type'] === 'fieldset')
) {
$form[$key]['#group'] = 'additional_settings';
}
}
// Hide `Description` field on term add/edit forms.
$form['description']['#access'] = FALSE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment