function context_layouts_reaction_block::get_active_layout in Context 6.3
Same name and namespace in other branches
- 6 context_layouts/plugins/context_layouts_reaction_block.inc \context_layouts_reaction_block::get_active_layout()
- 7.3 context_layouts/plugins/context_layouts_reaction_block.inc \context_layouts_reaction_block::get_active_layout()
Retrieve the first layout specified found by any active contexts.
3 calls to context_layouts_reaction_block::get_active_layout()
- context_layouts_reaction_block::add_layout_stylesheet in context_layouts/
plugins/ context_layouts_reaction_block.inc - Add the layout stylesheet to the CSS.
- context_layouts_reaction_block::add_layout_template in context_layouts/
plugins/ context_layouts_reaction_block.inc - Add the layout template to page vars.
- context_layouts_reaction_block::is_enabled_region in context_layouts/
plugins/ context_layouts_reaction_block.inc - Override of is_enabled_region(). Check that there is an active layout and it supports the given region.
File
- context_layouts/
plugins/ context_layouts_reaction_block.inc, line 19
Class
Code
function get_active_layout($info = TRUE) {
$contexts = $this
->get_contexts();
$layouts = context_layouts_get_layouts();
if (!empty($contexts) && !empty($layouts)) {
foreach ($contexts as $context) {
$values = $this
->fetch_from_context($context);
if (isset($values['layout']) && isset($layouts[$values['layout']])) {
return $info ? $layouts[$values['layout']] : $values['layout'];
}
}
}
// Fallback to default layout if provided.
if (isset($layouts['default'])) {
return $info ? $layouts['default'] : 'default';
}
return FALSE;
}