summarize_child_form_pages
- 6
summarize_child_form_pages($path, $trim = FALSE, $only_parent = FALSE)
Summarize the form pages that are children of the specified path.
Parameters
$path
The menu path to start from when checking for children forms.
$trim
When set to TRUE, summary data will only be included in the return array
when the summary actually has items.
$only_parent
When set to TRUE, forms will only be included from the given $path,
no recursion will be done
Return value
An array of data representing a form page summary including keys for the
page's 'path', and edit 'href', a summary 'title' and 'items'.
Code
contributions/ubercart/uc_store/includes/summaries.inc, line 173
<?php
function summarize_child_form_pages($path, $trim = FALSE, $only_parent = FALSE) {
$summaries = array();
$accessor = "LIKE '%s/%%'";
if ($only_parent) {
$accessor = "= '%s'";
}
$result = db_query("SELECT path FROM {menu_router} WHERE path ". $accessor ." ORDER BY weight", $path);
while ($row = db_fetch_array($result)) {
$item = menu_get_item($row['path']);
if ($item['access'] === FALSE) {
continue;
}
if ($item['page_callback'] == 'drupal_get_form') {
if ($item['type'] == MENU_DEFAULT_LOCAL_TASK) {
$parent = menu_get_item($item['tab_parent']);
$href = $parent['href'];
}
else {
$href = $item['href'];
}
$form_id = $item['page_arguments'][0];
if (!function_exists($form_id)) {
require_once($item['file']);
}
$form_state = array('storage' => NULL, 'submitted' => FALSE);
$form = drupal_retrieve_form($form_id, $form_state);
drupal_prepare_form($form_id, $form, $form_state);
$summary_items = summarize_form($form);
if (!$trim || $trim && count($summary_items) > 0) {
$summaries[] = array(
'path' => url($item['path']),
'href' => $href,
'title' => $item['title'],
'items' => $summary_items,
);
}
}
}
return $summaries;
}
?>