You are here

function _hierarchical_select_get_form_item in Hierarchical Select 5.3

Same name and namespace in other branches
  1. 6.3 hierarchical_select.module \_hierarchical_select_get_form_item()

Get the form item that has the the given #name property.

Parameters

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

$name: A #name value.

Return value

A form item.

1 call to _hierarchical_select_get_form_item()
hierarchical_select_json in ./hierarchical_select.module
Menu callback; format=text/json; generates and outputs the appropriate HTML.

File

./hierarchical_select.module, line 1391
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_get_form_item($form, $name) {
  if (isset($form['#name']) && $form['#name'] == $name) {
    return $form;
  }

  // The current form item apparently is not the one we're looking for, so try
  // to find it in the child form items.
  foreach (element_children($form) as $child) {
    $form_item = _hierarchical_select_get_form_item($form[$child], $name);
    if ($form_item !== FALSE) {
      return $form_item;
    }
  }

  // No match in the children either, so return FALSE.
  return FALSE;
}