You are here

function hook_shs_FIELDNAME_js_settings_alter in Simple hierarchical select 7

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

Alter Javascript settings for a single shs widget.

Parameters

array $settings_js: Javascript settings for the specified field.

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.

File

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

Code

function hook_shs_FIELDNAME_js_settings_alter(array &$settings_js, $field_name, $vocabulary_identifier) {
  foreach ($settings_js['shs'] as $field => &$container) {
    foreach ($container as $identifier => &$settings) {

      // Define labels for each level.
      $settings['labels'] = array(
        // No label for first level.
        FALSE,
        t('Country'),
        t('City'),
      );

      // Small speed-up for anmiations (defaults to 400ms).
      $settings['display']['animationSpeed'] = 100;
    }
  }
}