1.20.x layout.module | layout_layout_info() |
Implements hook_layout_info().
File
- modules/
layout/ layout.module, line 2194 - The Layout module creates pages and wraps existing pages in layouts.
Code
function layout_layout_info() {
$layouts = array();
$flexible_templates = layout_flexible_template_load_all();
$styles = layout_flexible_row_styles();
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_name_' . $i])) {
$region_name = $region['region_names']['region_name_' . $i];
}
else {
$region_name = $row_name . ' ' . $i;
}
$layouts[$flexible_template->name]['regions'][$row_name . '--' . $i] = $region_name;
}
}
}
return $layouts;
}