class context_field_context_condition in Context Field 7
Expose node views/node forms of specific node types as a context condition.
Hierarchy
- class \context_condition
Expanded class hierarchy of context_field_context_condition
2 string references to 'context_field_context_condition'
- context_field_context_plugins in ./
context_field.module - Implements hook_context_plugins().
- context_field_context_registry in ./
context_field.module - Implements hook_context_registry().
File
- plugins/
context_field_context_condition.inc, line 10 - context_field_context_condition.inc
View source
class context_field_context_condition extends context_condition {
function condition_values() {
// needs to return array of nid => titles
$values = array();
$values = array(
1 => t('Yes'),
2 => t('Default'),
);
return $values;
}
function get_context_name($node) {
return "sf-{$node->nid}";
}
function options_form($context) {
$defaults = $this
->fetch_from_context($context, 'options');
$form = array();
$form['context_field_category'] = array(
'#type' => 'textfield',
'#title' => t('Category'),
'#description' => t('The category of contexts for which you\'d like to utilize this context. For example, a category named blog for blog related contexts, which would differ from the contexts that could be used for basic pages.'),
'#default_value' => isset($defaults['context_field_category']) ? $defaults['context_field_category'] : '',
);
return $form;
}
function create_context($context_name) {
$context = (object) array(
'name' => $context_name,
'tag' => 'Context Field',
'reactions' => array(),
'conditions' => array(
'context_field' => array(
'values' => array(
1 => 1,
),
),
),
);
context_save($context);
return $context;
}
function execute($context_name) {
//If the context exist lets met its context_field condition
$contexts = $this
->get_contexts();
if ($context = isset($contexts[$context_name]) ? $contexts[$context_name] : FALSE) {
$this
->condition_met($context, 'context_field');
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
context_condition:: |
property | |||
context_condition:: |
property | |||
context_condition:: |
property | |||
context_condition:: |
property | |||
context_condition:: |
function | Condition form. | 3 | |
context_condition:: |
function | Condition form submit handler. | 2 | |
context_condition:: |
function | Marks a context as having met this particular condition. | ||
context_condition:: |
function | Check whether this condition is used by any contexts. Can be used to prevent expensive condition checks from being triggered when no contexts use this condition. | ||
context_condition:: |
function | Context editor form for conditions. | 2 | |
context_condition:: |
function | Context editor form submit handler. | ||
context_condition:: |
function | Retrieve options from the context provided. | ||
context_condition:: |
function | Retrieve all contexts with the condition value provided. | 2 | |
context_condition:: |
function | Options form submit handler. | ||
context_condition:: |
function | Settings form. Provide variable settings for your condition. | ||
context_condition:: |
function | Clone our references when we're being cloned. | ||
context_condition:: |
function | Constructor. Do not override. | ||
context_field_context_condition:: |
function |
Condition values. Overrides context_condition:: |
||
context_field_context_condition:: |
function | |||
context_field_context_condition:: |
function | |||
context_field_context_condition:: |
function | |||
context_field_context_condition:: |
function |
Options form. Provide additional options for your condition. Overrides context_condition:: |