summarize_child_form_pages

Versions
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'.

▾ 9 functions call summarize_child_form_pages()

uc_cart_cart_settings_overview in contributions/ubercart/uc_cart/uc_cart.admin.inc
Display an overview of the cart settings.
uc_cart_checkout_settings_overview in contributions/ubercart/uc_cart/uc_cart.admin.inc
Display an overview of the checkout settings.
uc_catalog_settings_overview in contributions/ubercart/uc_catalog/uc_catalog.admin.inc
Display an overview of the catalog settings.
uc_country_settings_overview in contributions/ubercart/uc_store/uc_store.admin.inc
Display an overview of the country settings.
uc_order_settings_overview in contributions/ubercart/uc_order/uc_order.admin.inc
Display an overview of the order settings.
uc_payment_settings_overview in contributions/ubercart/payment/uc_payment/uc_payment.admin.inc
uc_product_settings_overview in contributions/ubercart/uc_product/uc_product.admin.inc
Display overview of product settings.
uc_quote_overview in contributions/ubercart/shipping/uc_quote/uc_quote.admin.inc
Display an overview of the shipping quote settings.
uc_store_store_settings_overview in contributions/ubercart/uc_store/uc_store.admin.inc
Display an overview of the store settings.

Code

contributions/ubercart/uc_store/includes/summaries.inc, line 173

<?php
function summarize_child_form_pages($path, $trim = FALSE, $only_parent = FALSE) {
  $summaries = array();

  // Fetch and loop through any child menu items from the database.
  $accessor = "LIKE '%s/%%'";

  // If no_recur is TRUE, only look for the parent
  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']);
    // Only allow items the user can access.
    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;
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters (without spaces) shown in the image.