function context_reaction_block::options_form_submit in Context 7.3
Same name and namespace in other branches
- 6.3 plugins/context_reaction_block.inc \context_reaction_block::options_form_submit()
- 6 plugins/context_reaction_block.inc \context_reaction_block::options_form_submit()
Options form submit handler.
Overrides context_reaction::options_form_submit
1 call to context_reaction_block::options_form_submit()
- context_layouts_reaction_block::options_form_submit in context_layouts/
plugins/ context_layouts_reaction_block.inc - Override of submit handler.
1 method overrides context_reaction_block::options_form_submit()
- context_layouts_reaction_block::options_form_submit in context_layouts/
plugins/ context_layouts_reaction_block.inc - Override of submit handler.
File
- plugins/
context_reaction_block.inc, line 91
Class
- context_reaction_block
- Expose blocks as context reactions.
Code
function options_form_submit($values) {
$blocks = array();
$block_info = $this
->get_blocks();
// Retrieve blocks from submitted JSON string.
if (!empty($values['state'])) {
$edited = $this
->json_decode($values['state']);
}
else {
$edited = array();
}
foreach ($edited as $region => $block_data) {
foreach ($block_data as $position => $data) {
if (isset($block_info[$data->bid])) {
$blocks[$data->bid] = array(
'module' => $block_info[$data->bid]->module,
'delta' => $block_info[$data->bid]->delta,
'region' => $region,
'weight' => $data->weight,
);
}
}
}
return array(
'blocks' => $blocks,
);
}