1 layout.module layout_flexible_tempstore_load($flexible_template_name = NULL, $flexible_template_type = 'flexible')

Get a flexible template currently being edited from the tempstore.

If a template is not yet being edited, the template will be loaded from configuration.

Parameters

string $flexible_template_name: The machine name of the flexible template to load.

string $flexible_template_type: The type of flexible template to load. Defaults to 'flexible'.

Return value

LayoutFlexibleTemplate: The flexible template object.

File

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

Code

function layout_flexible_tempstore_load($flexible_template_name = NULL, $flexible_template_type = 'flexible') {
  _layout_standardize_template_type($flexible_template_type);
  if (!$flexible_template_name) {
    return new LayoutFlexibleTemplate();
  }

  $caches = &backdrop_static(__FUNCTION__ . ':' . $flexible_template_type, array());
  if (!isset($caches[$flexible_template_type . ':' . $flexible_template_name])) {
    if (!$item = tempstore_get('layout.' . $flexible_template_type, $flexible_template_name)) {
      $item = layout_flexible_template_load($flexible_template_name, $flexible_template_type);
    }
    $caches[$flexible_template_type . ':' . $flexible_template_name] = $item;
  }

  return $caches[$flexible_template_type . ':' . $flexible_template_name];
}