1.20.x layout.module layout_load_multiple_by_path($path, $skip_menu_items = NULL)

Load all layouts at a given path.

This function does not invoke hook_layout_load_by_router_item_alter(). In general, developers should use layout_load_multiple_by_router_item() rather than layout_load_multiple_by_path() to allow client modules to alter the layouts and only call this function in situations where client alteration is not desired and/or the router item is not available. Examples where this might be needed:

Parameters

string $path: The menu routing path, with all placeholders represented by "%" symbols.

bool $skip_menu_items: Flag to skip the attempted loading of menu items for the loaded layouts.

Return value

Layout[]: An array of load Layout object instances.

See also

dashboard_menu()

node_layout_load_by_router_item_alter()

File

modules/layout/layout.module, line 1032
The Layout module creates pages and wraps existing pages in layouts.

Code

function layout_load_multiple_by_path($path, $skip_menu_items = NULL) {
  if ($cache = cache('layout_path')->get($path)) {
    $layouts = $cache->data;

    // Populate these cached layouts into layout_load_multiple() to optimize
    // any future calls to it.
    $static_cache = &backdrop_static('layout_load_multiple', array());
    $static_cache = array_merge($layouts, $static_cache);
  }
  else {
    $layout_names = layout_get_path_layout_names($path);
    if (empty($layout_names)) {
      // Skip loading menu items for the default layouts.
      if (is_null($skip_menu_items)) {
        $skip_menu_items = TRUE;
      }
      if (path_is_admin($path)) {
        $layout_names[] = 'admin_default';
      }
      else {
        $layout_names[] = 'default';
      }
    }

    $layouts = layout_load_multiple($layout_names, $skip_menu_items);
    cache('layout_path')->set($path, $layouts);
  }
  return $layouts;
}