You are here

function hook_shs_js_settings_alter in Simple hierarchical select 7

Same name and namespace in other branches
  1. 8 shs.api.php \hook_shs_js_settings_alter()
  2. 2.0.x shs.api.php \hook_shs_js_settings_alter()

Alter Javascript settings of shs widgets in entity forms and views.

Parameters

array $settings_js: Javascript settings for shs widgets.

string $field_name: Name of field the provided settings are used for.

int|string $vocabulary_identifier: ID or machine_name of vocabulary the settings are used for.

2 invocations of hook_shs_js_settings_alter()
shs_field_widget_afterbuild in ./shs.module
Afterbuild callback for widgets of type "taxonomy_shs".
shs_handler_filter_term_node_tid::value_form in includes/handlers/shs_handler_filter_term_node_tid.inc
Options form subform for setting options.

File

./shs.api.php, line 89
Hooks for the shs module.

Code

function hook_shs_js_settings_alter(array &$settings_js, $field_name, $vocabulary_identifier) {
  if ($field_name == 'field_article_terms') {
    foreach ($settings_js['shs'] as $field => $container) {
      foreach ($container as $identifier => $settings) {
        $settings_js['shs'][$field][$identifier]['any_label'] = t('- Select an item -');
      }
    }
  }
}