You are here

class context_reaction_css_injector in Context 6.3

Same name and namespace in other branches
  1. 6 plugins/context_reaction_css_injector.inc \context_reaction_css_injector
  2. 7.3 plugins/context_reaction_css_injector.inc \context_reaction_css_injector

Hierarchy

Expanded class hierarchy of context_reaction_css_injector

2 string references to 'context_reaction_css_injector'
_context_context_plugins in ./context.plugins.inc
Context plugins.
_context_context_registry in ./context.plugins.inc
Context registry.

File

plugins/context_reaction_css_injector.inc, line 3

View source
class context_reaction_css_injector extends context_reaction {
  function options_form($context) {
    $list = array();
    foreach (_css_injector_load_rule() as $css_rule) {
      $list[$css_rule['crid']] = $css_rule['title'];
    }
    ksort($list);
    return array(
      '#title' => $this->title,
      '#description' => $this->description,
      '#options' => $list,
      '#type' => 'checkboxes',
      '#default_value' => $this
        ->fetch_from_context($context),
    );
  }
  function execute() {
    $contexts = $this
      ->get_contexts();
    foreach ($contexts as $context) {
      if (!empty($context->reactions[$this->plugin])) {
        foreach ($context->reactions[$this->plugin] as $crid) {
          if ($css_rule = _css_injector_load_rule($crid)) {
            drupal_add_css(file_create_path($css_rule['file_path']), 'module', $css_rule['media'], $css_rule['preprocess']);
          }
        }
      }
    }
  }

}

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.
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. 1
context_reaction::__clone function Clone our references when we're being cloned.
context_reaction::__construct function Constructor. Do not override.
context_reaction_css_injector::execute function
context_reaction_css_injector::options_form function Overrides context_reaction::options_form