You are here

function _panels_page_master_loader in Panels 6.2

Determine the render-time behavior of panels_page.

This function is basically the brains of the dynamic override system.

Parameters

string $name:

array $args:

Return value

array $load

1 call to _panels_page_master_loader()
panels_page_master_loader in panels_page/panels_page.module
Wrapper function for the actual panels_page master loader, _panels_page_master_loader().

File

panels_page/panels_page.module, line 288
panels_page.module

Code

function _panels_page_master_loader($name, $args) {
  static $loader_data = array();
  if (!empty($loader_data[$name])) {
    return $loader_data[$name];
  }
  $load = new stdClass();
  $loader_data[$name] =& $load;
  $load->panel_args = array();
  panels_load_include('plugins');
  panels_page_load_include('read');
  $panel_page = panels_page_load($name);
  $panel_page->context = array();

  // Handle static pages then duck out early.
  if (!($panel_page->load_flags & PANELS_IS_DYNAMIC)) {
    if ((bool) panels_page_access($panel_page->name)) {
      panels_page_load_include('render');
      panels_page_fetch_primary_display($panel_page);
      panels_page_prepare_panels_render($load, $panel_page);
    }
    return $load;
  }

  // Construct $panel_page->context and determine if we fall back.
  _panels_page_construct_argument_contexts($load, $panel_page, $args);

  // If we've determined that we're falling back...
  if ($load->fallback === TRUE) {

    // ...then bail out and do it.
    return panels_page_prepare_fallback_render($load, _panels_page_rebuild_menu_map($args, array_keys(explode('/', $panel_page->path), '%')));
  }

  // By now we are 100% certain that a panel_page render should occur, so check
  // the panels_page native access function. If that passes, then include the
  // the render inc file and proceed inside there.
  $load->access = panels_page_access($panel_page->name);
  if (empty($load->access)) {
    return drupal_access_denied();
  }
  panels_page_load_include('render');
  return panels_page_prepare_panels_render($load, $panel_page);
}