You are here

function _hierarchical_select_extract_settings in Hierarchical Select 5.2

Helper function to extract the settings from a form item.

Parameters

$element: A form item.

Return value

An array of setting name - setting value pairs.

1 call to _hierarchical_select_extract_settings()
hierarchical_select_process in ./hierarchical_select.module
Hierarchical select form element processing function.

File

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

Code

function _hierarchical_select_extract_settings($element) {
  return array(
    'module' => $element['#hierarchical_select_settings']['module'],
    'enforce_deepest' => (bool) $element['#hierarchical_select_settings']['enforce_deepest'],
    'save_lineage' => (bool) $element['#hierarchical_select_settings']['save_lineage'],
    'level_labels' => (array) $element['#hierarchical_select_settings']['level_labels'],
    'animation_delay' => (int) $element['#hierarchical_select_settings']['animation_delay'],
    'dropbox_title' => $element['#hierarchical_select_settings']['dropbox_title'],
    'dropbox_limit' => (int) $element['#hierarchical_select_settings']['dropbox_limit'],
    'params' => $element['#hierarchical_select_settings']['params'],
    'all_option' => (bool) $element['#hierarchical_select_settings']['all_option'],
    'required' => (bool) $element['#required'],
    'multiple' => (bool) $element['#multiple'],
    // When the #value property is empty, we're rendering this form (and thus
    // the form element) for the first time. When it's no longer empty, this
    // means that the validation failed and that we must keep the option that
    // was selected by the user.
    'selection' => !empty($element['#value']) ? $element['#value'] : $element['#default_value'],
  );
}