class panels_optional_context in Panels 6.2
Same name and namespace in other branches
- 5.2 includes/plugins.inc \panels_optional_context
- 6.3 includes/plugins.inc \panels_optional_context
Hierarchy
- class \panels_required_context
- class \panels_optional_context
Expanded class hierarchy of panels_optional_context
File
- includes/
plugins.inc, line 107 - plugins.inc
View source
class panels_optional_context extends panels_required_context {
function panels_optional_context() {
$args = func_get_args();
call_user_func_array(array(
$this,
'panels_required_context',
), $args);
}
/**
* Add the 'empty' context which is possible for optional
*/
function add_empty(&$contexts) {
$context = new panels_context('any');
$context->title = t('No context');
$context->identifier = t('No context');
$contexts = array_merge(array(
'empty' => $context,
), $contexts);
}
function filter($contexts) {
$this
->add_empty($contexts);
return parent::filter($contexts);
}
function select($contexts, $context) {
$this
->add_empty($contexts);
if (empty($context)) {
return $contexts['empty'];
}
$result = parent::select($contexts, $context);
// Don't flip out if it can't find the context; this is optional, put
// in an empty.
if ($result == FALSE) {
$result = $contexts['empty'];
}
return $result;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
panels_optional_context:: |
function | Add the 'empty' context which is possible for optional | ||
panels_optional_context:: |
function |
Overrides panels_required_context:: |
||
panels_optional_context:: |
function | |||
panels_optional_context:: |
function |
Overrides panels_required_context:: |
||
panels_required_context:: |
property | |||
panels_required_context:: |
function |