1 layout.module | layout_layout_template_info() |
Implements hook_layout_template_info().
File
- core/
modules/ layout/ layout.module, line 2455 - The Layout module creates pages and wraps existing pages in layouts.
Code
function layout_layout_template_info() {
$layouts = array();
$styles = layout_flexible_row_styles();
$flexible_templates = layout_flexible_template_load_all();
foreach ($flexible_templates as $flexible_template) {
$layouts[$flexible_template->name] = array(
'title' => $flexible_template->title,
'regions' => array(),
'default region' => '',
'template' => 'layout--flexible',
'flexible' => TRUE,
'type' => 'layout',
'path' => 'templates',
'preview' => 'flexible_template.png',
'libraries' => array('bootstrap4-gs'),
);
foreach ($flexible_template->rows as $row_name => $region) {
$region_style = $styles[$region['contains']];
for ($i = 0; $i < $region_style['region_count']; $i++) {
if (!empty($region['region_names']['region_' . $i]['label'])) {
$region_name = $region['region_names']['region_' . $i]['label'];
}
else {
$region_name = $row_name . ' ' . $i;
}
$layouts[$flexible_template->name]['regions'][$row_name . '--' . $i] = $region_name;
}
}
}
return $layouts;
}