You are here

function context_condition_path::execute in Context 7.3

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

Execute.

3 methods override context_condition_path::execute()
context_condition_context::execute in plugins/context_condition_context.inc
Execute.
context_condition_context_all::execute in plugins/context_condition_context_all.inc
Execute.
context_condition_query_string::execute in plugins/context_condition_query_string.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[0] != $_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);
      }
    }
  }
}