You are here

function context_condition_path::execute in Context 6

Same name and namespace in other branches
  1. 6.3 plugins/context_condition_path.inc \context_condition_path::execute()
  2. 7.3 plugins/context_condition_path.inc \context_condition_path::execute()

Execute.

1 method overrides context_condition_path::execute()
context_condition_context::execute in plugins/context_condition_context.inc
Execute.

File

plugins/context_condition_path.inc, line 46

Class

context_condition_path
Expose paths as a context condition.

Code

function execute() {
  if ($this
    ->condition_used()) {

    // Include both the path alias and normal path for matching.
    $current_path = array(
      drupal_get_path_alias($_GET['q']),
    );
    if ($current_path != $_GET['q']) {
      $current_path[] = $_GET['q'];
    }
    foreach ($this
      ->get_contexts() as $context) {
      $paths = $this
        ->fetch_from_context($context, 'values');
      if ($this
        ->match($current_path, $paths, TRUE)) {
        $this
          ->condition_met($context);
      }
    }
  }
}