You are here

contexturl.module in Context URL 7

Implements the necessary hooks for Context URL to work properly.

File

contexturl.module
View source
<?php

/**
 * @file
 * Implements the necessary hooks for Context URL to work properly.
 */

/**
 * Implements hook_context_plugins().
 */
function contexturl_context_plugins() {
  $module_path = drupal_get_path('module', 'contexturl');
  $plugins = array();
  $plugins['contexturl_condition_url'] = array(
    'handler' => array(
      'path' => $module_path . '/plugins',
      'file' => 'contexturl_condition_url.inc',
      'class' => 'contexturl_condition_url',
      'parent' => 'context_condition',
    ),
  );
  return $plugins;
}

/**
 * Implements hook_context_registry().
 */
function contexturl_context_registry() {
  return array(
    'conditions' => array(
      'url' => array(
        'title' => t('Page URL'),
        'description' => t('Use a simple formula to check the page url: you can use use wildchar "*".'),
        'plugin' => 'contexturl_condition_url',
      ),
    ),
  );
}

/**
 * Implements hook_init().
 */
function contexturl_init() {
  $map = context_condition_map();
  if (!empty($map['url']) && ($plugin = context_get_plugin('condition', 'url'))) {
    $plugin
      ->execute();
  }
}