class context_reaction_disable_context in Context Disable Context 7
Same name and namespace in other branches
- 6.3 plugins/context_reaction_disable_context.inc \context_reaction_disable_context
- 6 plugins/context_reaction_disable_context.inc \context_reaction_disable_context
- 7.3 plugins/context_reaction_disable_context.inc \context_reaction_disable_context
Expose themes as context reactions.
Hierarchy
- class \context_reaction
Expanded class hierarchy of context_reaction_disable_context
2 string references to 'context_reaction_disable_context'
- context_disable_context_context_plugins in ./
context_disable_context.module - CTools plugin API hook for Context. Note that a proper entry in hook_ctools_plugin_api() must exist for this hook to be called.
- context_disable_context_context_registry in ./
context_disable_context.module - Registry hook for conditions & reactions.
File
- plugins/
context_reaction_disable_context.inc, line 7
View source
class context_reaction_disable_context extends context_reaction {
/**
* Allow admins to provide a section title, section subtitle and section class.
*/
function options_form($context) {
$defaults = $this
->fetch_from_context($context);
$values = context_context_list();
ksort($values);
// TODO: exclude current context from $values
$form = array();
$form['disabled'] = array(
'#title' => t('Contexts to disable'),
'#decription' => t('Select the contexts that should be disabled'),
'#type' => 'checkboxes',
'#multiple' => TRUE,
'#options' => $values,
'#default_value' => isset($defaults['disabled']) ? $defaults['disabled'] : array(),
);
return $form;
}
/**
* Options form submit handler.
*/
function options_form_submit($values) {
$values['disabled'] = array_filter($values['disabled']);
return $values;
}
function execute() {
$contexts = $this
->get_contexts();
$processed = array();
foreach ($contexts as $context) {
$values = $this
->fetch_from_context($context);
foreach ($values['disabled'] as $disable) {
if (context_isset('context', $disable) && !in_array($disable, $processed)) {
context_set('context', $disable, FALSE);
}
}
// Add the current context to $processed so it is not removed by other contexts
$processed[] = $context->name;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
context_reaction:: |
property | |||
context_reaction:: |
property | |||
context_reaction:: |
property | |||
context_reaction:: |
function | Retrieve options from the context provided. | 1 | |
context_reaction:: |
function | Retrieve active contexts that have values for this reaction. | ||
context_reaction:: |
function | Settings form. Provide variable settings for your reaction. | 2 | |
context_reaction:: |
function | Clone our references when we're being cloned. | ||
context_reaction:: |
function | Constructor. Do not override. | ||
context_reaction_disable_context:: |
function | |||
context_reaction_disable_context:: |
function |
Allow admins to provide a section title, section subtitle and section class. Overrides context_reaction:: |
||
context_reaction_disable_context:: |
function |
Options form submit handler. Overrides context_reaction:: |