function hs_taxonomy_form_field_ui_field_edit_form_alter in Hierarchical Select 7.3
Implements hook_form_FORMID_alter().
Alter the field settings form; dynamically disable the "cardinality" (or "Number of values" in the UI) setting on the form when either the dropbox or "save lineage" is enabled.
File
- modules/
hs_taxonomy.module, line 153 - Implementation of the Hierarchical Select API for the Taxonomy module.
Code
function hs_taxonomy_form_field_ui_field_edit_form_alter(&$form, &$form_state) {
if (isset($form['#field']['type']) && $form['#field']['type'] === 'taxonomy_term_reference' && $form['#instance']['widget']['type'] == 'taxonomy_hs') {
require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'hierarchical_select') . '/includes/common.inc';
$config = hierarchical_select_common_config_get(hs_taxonomy_get_config_id($form['#field']['field_name']));
if ($config['dropbox']['status'] || $config['save_lineage']) {
$form['field']['cardinality']['#disabled'] = TRUE;
$form['field']['cardinality']['#description'] .= ' <strong>' . t('This setting is now managed by the Hierarchical Select configuration.') . '</strong>';
}
}
}