class context_og_reaction_set_group_context in Context OG 7.2
Same name and namespace in other branches
- 6.3 plugins/context_og_reaction_set_group_context.inc \context_og_reaction_set_group_context
- 7 plugins/context_og_reaction_set_group_context.inc \context_og_reaction_set_group_context
Expose organic groups as context reactions.
Hierarchy
- class \context_reaction
Expanded class hierarchy of context_og_reaction_set_group_context
3 string references to 'context_og_reaction_set_group_context'
- context_og_context_page_condition in ./
context_og.module - Execute the "set group context" reaction here so that our conditions will work when they get executed. We want to come after organic groups' hook_init() so the context doesn't get switched out from under us.
- context_og_context_plugins in ./
context_og.module - context_og_context_registry in ./
context_og.module - Implementation of hook_context_registry().
File
- plugins/
context_og_reaction_set_group_context.inc, line 6
View source
class context_og_reaction_set_group_context extends context_reaction {
/**
* Choose a group whose OG context will be set for this reaction.
*/
function options_form($context) {
$result = og_get_all_group();
$options = array();
foreach ($result as $gid) {
$group = node_load($gid);
$type = node_type_get_name($group->type);
$options[$gid] = $type . ': ' . $group->title;
}
$values = $this
->fetch_from_context($context);
$form = array(
'group' => array(
'#title' => t('Group'),
'#description' => t('Set the group context to the selected group.'),
'#type' => 'select',
'#multiple' => FALSE,
'#options' => $options,
'#default_value' => isset($values['group']) ? $values['group'] : '',
),
);
return $form;
}
function execute() {
$contexts = context_active_contexts();
//dpm($contexts);
foreach ($contexts as $k => $v) {
if (!empty($v->reactions[$this->plugin]['group'])) {
$group = node_load($v->reactions[$this->plugin]['group']);
og_context($group);
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
context_og_reaction_set_group_context:: |
function | |||
context_og_reaction_set_group_context:: |
function |
Choose a group whose OG context will be set for this reaction. Overrides context_reaction:: |
||
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 | Options form submit handler. | 3 | |
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. |