You are here

function panels_page_admin_load in Panels 6.2

Menu loader for some panels_page admin screens. Loads the panels_page specified by the name arg, induces a 404 when a bad arg is provided.

Use the empty string so that the behavior of callers that don't pass arg(6) will be the same as callers who do pass arg(6), but arg(6) is empty.

Parameters

string $name:

string $which:

Return value

mixed

File

panels_page/panels_page.module, line 118
panels_page.module

Code

function panels_page_admin_load() {

  // Lets us tell if this is the first time through the function. Fugly hack to
  // do it this way, but this gets called numerous times by theme(), which makes
  // it the only way to avoid generating superfluous object cache items due to
  // later indirect calls to this function made by access checking within
  // theme(). They entries get get cleared later, but it's still icky, so we
  // head it off here.
  static $first = TRUE;
  panels_page_load_include('write');
  panels_load_include('plugins');
  $args = func_get_args();
  $name = array_shift($args);
  $which = array_shift($args);
  if (function_exists($which) && $first) {
    return $which($name, array_shift($args));
  }
  $first = FALSE;
  $panel_page = panels_page_load($name);
  panels_page_fetch_display($panel_page, $which);
  panels_page_set_current($panel_page);
  return is_object($panel_page) && !empty($panel_page->pid) ? $panel_page : FALSE;
}