You are here

function date_restrictions_element_leaf_children in Date Restrictions 7

Helper function to get leaf children of a form element.

Recursively descend $element until its leaves.

2 calls to date_restrictions_element_leaf_children()
date_restrictions_host_entity_form_after_build in modules/host_entity/date_restrictions_host_entity.module
Implements after build callback.
date_restrictions_host_entity_form_alter in modules/host_entity/date_restrictions_host_entity.module
Implements hook_form_alter().

File

./date_restrictions.module, line 271

Code

function date_restrictions_element_leaf_children(&$element, $leaves = array()) {
  $children = element_children($element);
  foreach ($children as $child) {
    $c = element_children($element[$child]);
    if (empty($c)) {
      $leaves[] =& $element[$child];
    }
    else {
      $leaves = array_merge($leaves, date_restrictions_element_leaf_children($element[$child]));
    }
  }
  return $leaves;
}