1 layout.module layout_flexible_template_load_all($flexible_type = 'flexible')

Load all flexible templates by type. Defaults to 'flexible'.

Parameters

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

Return value

LayoutFlexibleTemplate[]:

File

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

Code

function layout_flexible_template_load_all($flexible_type = 'flexible') {
  _layout_standardize_template_type($flexible_type);
  $templates = &backdrop_static(__FUNCTION__ . ':' . $flexible_type, array());

  if (empty($templates)) {
    $cache = cache()->get('layout:' . $flexible_type . ':config');
    if ($cache && $cache->data) {
      $configs = $cache->data;
    }
    else {
      $configs = array();
      $config_names = config_get_names_with_prefix('layout.' . $flexible_type . '.');
      foreach ($config_names as $config_file) {
        $config = config($config_file);
        $data = $config->get();
        $configs[$data['name']] = $data;
      }

      cache()->set('layout:' . $flexible_type . ':config', $configs);
    }

    foreach ($configs as $template_name => $config) {
      $config['layout_template_type'] = $flexible_type;
      $templates[$template_name] = new LayoutFlexibleTemplate($config);
    }
  }

  return $templates;
}