function icon_select_form_taxonomy_vocabulary_form_alter in Icon Select 8
Implements hook_form_FORM_ID_alter().
File
- ./
icon_select.module, line 66 - Basic module file for icon_select module.
Code
function icon_select_form_taxonomy_vocabulary_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$vid = 'icons';
$vocabulary = $form_state
->getFormObject()
->getEntity();
$config = \Drupal::config('icon_select.settings');
if ($vid == $vocabulary
->id()) {
$form['path'] = [
'#type' => 'textfield',
'#title' => t('Path of SVG sprite file'),
'#default_value' => !empty($config
->get('path')) ? $config
->get('path') : 'icons/icon_select_map.svg',
'#description' => t('Relative to the files folder'),
'#weight' => 0,
];
// Do not allow to delete forum's vocabulary.
$form['actions']['delete']['#access'] = FALSE;
// Do not allow to change a vid of forum's vocabulary.
$form['vid']['#disabled'] = TRUE;
$form['actions']['submit']['#submit'][] = 'icon_select_vocabulary_form_submit';
}
}