You are here

function _hierarchical_select_get_form_item_by_parents in Hierarchical Select 5.3

Same name and namespace in other branches
  1. 6.3 includes/common.inc \_hierarchical_select_get_form_item_by_parents()
  2. 7.3 includes/common.inc \_hierarchical_select_get_form_item_by_parents()

Get the form element of a form that has a certain lineage of parents.

Parameters

$form: A structured array for use in the Forms API.

$parents: An array of parent form element names.

Return value

The form element that has the specified lineage of parents.

1 call to _hierarchical_select_get_form_item_by_parents()
hierarchical_select_common_config_form_submit in includes/common.inc
Submit callback for the hierarchical_select_common_config_form form.

File

includes/common.inc, line 482
Functions used by more than one Hierarchical Select implementation.

Code

function _hierarchical_select_get_form_item_by_parents($form, $parents) {
  if (count($parents)) {
    $parent = array_shift($parents);
    return _hierarchical_select_get_form_item_by_parents($form[$parent], $parents);
  }
  else {
    return $form;
  }
}