You are here

function _hierarchical_select_inherit_default_config in Hierarchical Select 6.3

Same name and namespace in other branches
  1. 5.3 hierarchical_select.module \_hierarchical_select_inherit_default_config()
  2. 7.3 hierarchical_select.module \_hierarchical_select_inherit_default_config()

Inherit the default config from Hierarchical Selects' hook_elements().

Parameters

$config: A config array with at least the following settings:

  • module
  • params

Return value

An updated config array.

6 calls to _hierarchical_select_inherit_default_config()
hierarchical_select_common_config_get in includes/common.inc
Retrieve a config. If certain settings are not yet configured by the user, defaults will be set. These defaults can also be overriden. This allows modules to provide their own meaningful defaults.
hierarchical_select_process in ./hierarchical_select.module
Hierarchical select form element type #process callback.
_hierarchical_select_form_set_error_class in ./hierarchical_select.module
Set the 'error' class on the appropriate part of Hierarchical Select, depending on its configuration.
_hierarchical_select_process_calculate_selections in ./hierarchical_select.module
Calculates the flat selections of both the hierarchical select and the dropbox.
_hierarchical_select_process_get_hs_selection in ./hierarchical_select.module
Get the current (flat) selection of the hierarchical select.

... See full list

File

./hierarchical_select.module, line 1285
This module defines the "hierarchical_select" form element, which is a greatly enhanced way for letting the user select items in a hierarchy.

Code

function _hierarchical_select_inherit_default_config($config, $defaults_override = array()) {

  // Set defaults for unconfigured settings. Get the defaults from our
  // hook_elements() implementation. Default properties from this hook are
  // applied automatically, but properties inside properties, such as is the
  // case for Hierarchical Select's #config property, aren't applied.
  $type = hierarchical_select_elements();
  $defaults = $type['hierarchical_select']['#config'];

  // Don't inherit the module and params settings.
  unset($defaults['module']);
  unset($defaults['params']);

  // Allow the defaults to be overridden.
  $defaults = array_smart_merge($defaults, $defaults_override);

  // Apply the defaults to the config.
  $config = array_smart_merge($defaults, $config);
  return $config;
}