1.20.x layout.module layout_flexible_template_load_all()

Load all flexible templates.

Return value

LayoutFlexibleTemplate[]:

File

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

Code

function layout_flexible_template_load_all() {
  $templates = &backdrop_static(__FUNCTION__, array());

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

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

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

  return $templates;
}