You are here

class olark_context_reaction_add in Olark Chat 7

Same name and namespace in other branches
  1. 6 plugins/olark_context_reaction_add.inc \olark_context_reaction_add

Add Olark code to the page.

Hierarchy

Expanded class hierarchy of olark_context_reaction_add

2 string references to 'olark_context_reaction_add'
olark_context_plugins in ./olark.module
CTools plugin API hook for Context.
olark_context_registry in ./olark.module
Implements hook_context_registry().

File

plugins/olark_context_reaction_add.inc, line 11
Adds a Context module reaction for the Olark module.

View source
class olark_context_reaction_add extends context_reaction {

  /**
   * Builds and options form for Olark context.
   */
  public function options_form($context) {
    return array(
      'add' => array(
        '#type' => 'value',
        '#value' => TRUE,
      ),
      'note' => array(
        '#type' => 'markup',
        '#value' => t('Olark chat code will be added to the page.'),
      ),
    );
  }

  /**
   * Submit handler for the options form.
   */
  public function options_form_submit($values) {
    return array(
      'add' => 1,
    );
  }

  /**
   * Execute the contexts.
   */
  public function execute() {
    $contexts = $this
      ->get_contexts();
    foreach ($contexts as $context) {
      if (!empty($context->reactions[$this->plugin])) {
        return TRUE;
      }
    }
  }

}

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::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.
olark_context_reaction_add::execute public function Execute the contexts.
olark_context_reaction_add::options_form public function Builds and options form for Olark context. Overrides context_reaction::options_form
olark_context_reaction_add::options_form_submit public function Submit handler for the options form. Overrides context_reaction::options_form_submit