You are here

function _filter_configure_form_recur in Ubercart 6.2

Recursive filter configuration.

1 call to _filter_configure_form_recur()
filter_configure_form in ca/ca.module
Configure the #parents and #id field of any child filter_forms.

File

ca/ca.module, line 1044
This is a demonstration module for the new conditional actions API.

Code

function _filter_configure_form_recur(&$form, &$formats, $parents) {

  // Look for our special element, then search the children.
  if (isset($form['#is_format']) ? $form['#is_format'] : FALSE) {
    foreach (element_children($form) as $key) {

      // Found a filter.
      if (array_key_exists($key, $formats)) {

        // Configure the parents and ID so FAPI is happy.
        $form[$key] = array(
          '#parents' => $parents,
          '#id' => form_clean_id('edit-' . implode('-', array_merge($parents, array(
            $key,
          )))),
        ) + $form[$key];
      }
    }
  }
  else {

    // Keep looking.
    foreach (element_children($form) as $key) {
      _filter_configure_form_recur($form[$key], $formats, array_merge($parents, array(
        $key,
      )));
    }
  }
}