You are here

class SiteBannerContextReactionChangeBannerStatus in Site Banner 7

Handle enabling/disabling the site banner and debug mode.

Hierarchy

Expanded class hierarchy of SiteBannerContextReactionChangeBannerStatus

1 string reference to 'SiteBannerContextReactionChangeBannerStatus'
site_banner_context_plugins in ./site_banner.module
Implements hook_context_plugins().

File

./site_banner_context_reaction_functions.inc, line 13

View source
class SiteBannerContextReactionChangeBannerStatus extends context_reaction {

  /**
   * Admin panel for setting banner background color for selected contexts.
   */
  public function options_form($context) {
    $existing_status = site_banner_get_site_banner_status($context);
    $existing_debug_status = site_banner_get_site_banner_debug_status($context);
    return site_banner_generate_banner_status_form_elements($existing_status, $existing_debug_status);
  }

  /**
   * Validate hook for context-specific site banner background color settings.
   */
  public function options_form_validate($form_state) {

    // Not linked into context module.
    // TODO: raise bug to allow validation of reaction fields.
  }

  /**
   * Submit handler for context-specific site banner background color settings.
   */
  public function options_form_submit($values) {
    return $values;
  }

  /**
   * Output banner background colour for active contexts.
   */
  public function execute(&$site_banner_status, &$site_banner_debug_status) {
    $contexts = context_active_contexts();
    foreach ($contexts as $context) {
      if (!empty($context->reactions['change_banner_status'])) {
        $site_banner_status |= site_banner_get_site_banner_status($context);
        $site_banner_debug_status |= site_banner_get_site_banner_debug_status($context);
      }
    }
  }

}

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.
SiteBannerContextReactionChangeBannerStatus::execute public function Output banner background colour for active contexts.
SiteBannerContextReactionChangeBannerStatus::options_form public function Admin panel for setting banner background color for selected contexts. Overrides context_reaction::options_form
SiteBannerContextReactionChangeBannerStatus::options_form_submit public function Submit handler for context-specific site banner background color settings. Overrides context_reaction::options_form_submit
SiteBannerContextReactionChangeBannerStatus::options_form_validate public function Validate hook for context-specific site banner background color settings.