function uc_catalog_form_taxonomy_vocabulary_form_alter in Ubercart 8.4
Implements hook_form_BASE_FORM_ID_alter() for taxonomy_vocabulary_form().
File
- uc_catalog/
uc_catalog.module, line 68 - Ubercart Catalog module.
Code
function uc_catalog_form_taxonomy_vocabulary_form_alter(&$form, &$form_state, $form_id) {
$vid = \Drupal::config('uc_catalog.settings')
->get('vocabulary');
$vocabulary = $form_state
->getFormObject()
->getEntity();
if ($vid == $vocabulary
->id()) {
$form['help_catalog_vocab'] = [
'#markup' => t('This is the designated product catalog vocabulary. It cannot be deleted until the Catalog module is uninstalled. The machine name of this vocabulary may not be changed.'),
'#weight' => -1,
];
// @todo - does the 'hierarchy' element do anything?
// Catalog vocabulary always has single hierarchy.
$form['hierarchy']['#value'] = TAXONOMY_HIERARCHY_SINGLE;
// Do not allow the catalog vocabulary to be deleted.
$form['actions']['delete']['#access'] = FALSE;
// Do not allow the catalog vid to be changed.
$form['vid']['#disabled'] = TRUE;
}
}