views_isotope_reaction.inc in Brainstorm profile 7
Contains the isotope_reaction subclass.
File
modules/custom/views_isotope/plugins/context/views_isotope_reaction.incView source
<?php
/**
* @file
* Contains the isotope_reaction subclass.
*/
/**
* Expose isotope configurations as context reactions.
*/
class IsotopeReaction extends context_reaction {
/**
* Editor form.
*/
public function editorForm($context) {
$form = $this
->optionsForm($context);
return $form;
}
/**
* Submit handler for editor form.
*/
public function editorFormSubmit($context, $values) {
return $values;
}
/**
* Configuration form for the Isotope context reaction.
*/
public function optionsForm($context) {
$values = $this
->fetch_from_context($context);
$form = [
'#tree' => TRUE,
'#title' => t('Isotope'),
'pre' => [
'#type' => 'item',
'#title' => t('Isotope Configuration'),
'#description' => t('You can manage these configurations at !link.', [
'!link' => l(t('Configure Isotope'), 'admin/config/user-interface/isotope'),
]),
],
// Choose the config here.
'config' => [
'#type' => 'select',
'#options' => views_isotope_available_configs(),
'#title' => t('Choose Isotope Configuration'),
'#default_value' => isset($values['config']) ? $values['config'] : 'isotope_default_config',
],
];
return $form;
}
/**
* Display a message to the user.
*/
public function execute() {
foreach ($this
->get_contexts() as $k => $v) {
if (!empty($v->reactions[$this->plugin]['config'])) {
return $v->reactions[$this->plugin]['config'];
}
}
}
}
Classes
Name | Description |
---|---|
IsotopeReaction | Expose isotope configurations as context reactions. |