You are here

class IsotopeReaction in Brainstorm profile 7

Expose isotope configurations as context reactions.

Hierarchy

Expanded class hierarchy of IsotopeReaction

2 string references to 'IsotopeReaction'
views_isotope_context_plugins in modules/custom/views_isotope/views_isotope.module
Implements hook_context_plugins().
views_isotope_context_registry in modules/custom/views_isotope/views_isotope.module
Implements hook_context_registry().

File

modules/custom/views_isotope/plugins/context/views_isotope_reaction.inc, line 11
Contains the isotope_reaction subclass.

View source
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'];
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
context_reaction::$description property
context_reaction::$plugin property
context_reaction::$title property
context_reaction::fetch_from_context function Retrieve options from the context provided. 1
context_reaction::get_contexts function Retrieve active contexts that have values for this reaction.
context_reaction::options_form function 7
context_reaction::options_form_submit function Options form submit handler. 3
context_reaction::settings_form function Settings form. Provide variable settings for your reaction. 2
context_reaction::__clone function Clone our references when we're being cloned.
context_reaction::__construct function Constructor. Do not override.
IsotopeReaction::editorForm public function Editor form.
IsotopeReaction::editorFormSubmit public function Submit handler for editor form.
IsotopeReaction::execute public function Display a message to the user.
IsotopeReaction::optionsForm public function Configuration form for the Isotope context reaction.