function context_ui_editor_process in Context 6.3
Same name and namespace in other branches
- 7.3 context_ui/context_ui.module \context_ui_editor_process()
Values processor for context_ui_editor_submit(). Split out for reuse by overriding submit handlers.
1 call to context_ui_editor_process()
- context_ui_editor_submit in context_ui/
context_ui.module - Save handler for context_block_editor().
File
- context_ui/
context_ui.module, line 181
Code
function context_ui_editor_process($values) {
$context = $values['context'];
foreach (array_keys(context_conditions()) as $condition) {
if (isset($values['condition'][$condition])) {
$plugin = context_get_plugin('condition', $condition);
if ($plugin && method_exists($plugin, 'editor_form_submit')) {
$context->conditions[$condition]['values'] = $plugin
->editor_form_submit($context, $values['condition'][$condition]);
}
}
if (isset($context->conditions[$condition]) && context_empty($context->conditions[$condition]['values'])) {
unset($context->conditions[$condition]);
}
}
foreach (array_keys(context_reactions()) as $reaction) {
if (isset($values["reaction-{$reaction}"])) {
$plugin = context_get_plugin('reaction', $reaction);
if ($plugin && method_exists($plugin, 'editor_form_submit')) {
$context->reactions[$reaction] = $plugin
->editor_form_submit($context, $values["reaction-{$reaction}"]);
}
}
if (isset($context->reactions[$reaction]) && context_empty($context->reactions[$reaction])) {
unset($context->reactions[$reaction]);
}
}
return $context;
}