public function PanelizerEntityDefault::get_base_contexts in Panelizer 7.2
Same name and namespace in other branches
- 7.3 plugins/entity/PanelizerEntityDefault.class.php \PanelizerEntityDefault::get_base_contexts()
Callback to get the base context for a panelized entity
Overrides PanelizerEntityInterface::get_base_contexts
1 call to PanelizerEntityDefault::get_base_contexts()
- PanelizerEntityDefault::get_contexts in plugins/
entity/ PanelizerEntityDefault.class.php - Fetch an object array of CTools contexts from panelizer information.
File
- plugins/
entity/ PanelizerEntityDefault.class.php, line 1617 - Base class for the Panelizer Entity plugin.
Class
- PanelizerEntityDefault
- Base class for the Panelizer Entity plugin.
Code
public function get_base_contexts($entity = NULL) {
ctools_include('context');
if ($entity) {
$context = ctools_context_create('entity:' . $this->entity_type, $entity);
}
else {
$context = ctools_context_create_empty('entity:' . $this->entity_type);
// The placeholder is needed to create the form used for the live
// preview.
$context->placeholder = array(
'type' => 'context',
'conf' => array(
'name' => $this->entity_type,
'identifier' => $this
->entity_identifier($entity),
'keyword' => $this->entity_type,
'context_settings' => array(),
),
);
}
$context->identifier = $this
->entity_identifier($entity);
$context->keyword = $this->entity_type;
return array(
'panelizer' => $context,
);
}