You are here

class masquerade_is_masquerading_context_condition in Masquerade Extras 6

@file Expose current user role as a context condition.

Hierarchy

Expanded class hierarchy of masquerade_is_masquerading_context_condition

1 string reference to 'masquerade_is_masquerading_context_condition'
masquerade_context_context_plugins in masquerade_context/masquerade_context.module
Implements hook_context_plugins().

File

masquerade_context/plugins/condition/masquerade_is_masquerading.inc, line 6
Expose current user role as a context condition.

View source
class masquerade_is_masquerading_context_condition extends context_condition {

  /**
   * For whatever reason, custom plugins' settings get ignored when the context
   * editor saves values.
   */
  function condition_values() {
    return array(
      1 => t('Evaluate this context when the current user is posing as someone else.'),
    );
  }

  /**
   * Evaluates the condition.
   */
  function execute() {
    if (isset($_SESSION['masquerading']) && is_numeric($_SESSION['masquerading'])) {
      foreach ($this
        ->get_contexts() as $context) {
        $this
          ->condition_met($context, 'is_masquerading');
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
masquerade_is_masquerading_context_condition::condition_values function For whatever reason, custom plugins' settings get ignored when the context editor saves values.
masquerade_is_masquerading_context_condition::execute function Evaluates the condition.