function micon_vocabulary_form_taxonomy_vocabulary_form_alter in Micon 8
Same name and namespace in other branches
- 2.x micon_vocabulary/micon_vocabulary.module \micon_vocabulary_form_taxonomy_vocabulary_form_alter()
Implements hook_form_FORM_ID_alter().
Adds icon options to the vocabulary form.
See also
VocabularyForm::form()
File
- micon_vocabulary/
micon_vocabulary.module, line 19 - Contains micon_vocabulary.module.
Code
function micon_vocabulary_form_taxonomy_vocabulary_form_alter(&$form, FormStateInterface $form_state) {
/** @var \Drupal\taxonomy\VocabularyInterface $type */
$type = $form_state
->getFormObject()
->getEntity();
$form['icon'] = [
'#type' => 'micon',
'#title' => t('Icon'),
'#default_value' => micon_vocabulary_icon($type),
'#weight' => 0,
];
$form['#entity_builders'][] = 'micon_vocabulary_form_taxonomy_vocabulary_form_builder';
}