You are here

class isotope_reaction in Isotope (with Masonry and Packery) 7.2

Same name and namespace in other branches
  1. 7 plugins/isotope_reaction.inc \isotope_reaction

Expose isotope configurations as context reactions.

Hierarchy

Expanded class hierarchy of isotope_reaction

2 string references to 'isotope_reaction'
isotope_context_plugins in ./isotope.module
Implements hook_context_plugins().
isotope_context_registry in ./isotope.module
Implements hook_context_registry().

File

plugins/context/isotope_reaction.inc, line 10
Contains the isotope_reaction subclass.

View source
class isotope_reaction extends context_reaction {

  /**
   * Editor form.
   */
  public function editor_form($context) {
    $form = $this
      ->options_form($context);
    return $form;
  }

  /**
   * Submit handler for editor form.
   */
  public function editor_form_submit($context, $values) {
    return $values;
  }

  /**
   * Configuration form for the Isotope context reaction.
   */
  public function options_form($context) {
    $values = $this
      ->fetch_from_context($context);
    $form = array(
      '#tree' => TRUE,
      '#title' => t('Isotope'),
      'pre' => array(
        '#type' => 'item',
        '#title' => t('Isotope Configuration'),
        '#description' => t('You can manage these configurations at !link.', array(
          '!link' => l(t('Configure Isotope'), 'admin/config/user-interface/isotope'),
        )),
      ),
      // Choose the config here.
      'config' => array(
        '#type' => 'select',
        '#options' => 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_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.
isotope_reaction::editor_form public function Editor form.
isotope_reaction::editor_form_submit public function Submit handler for editor form.
isotope_reaction::execute public function Display a message to the user.
isotope_reaction::options_form public function Configuration form for the Isotope context reaction. Overrides context_reaction::options_form