You are here

function themekey_prepare_custom_path in ThemeKey 6.3

Same name and namespace in other branches
  1. 6.4 themekey_build.inc \themekey_prepare_custom_path()
  2. 6.2 themekey_build.inc \themekey_prepare_custom_path()
  3. 7.3 themekey_build.inc \themekey_prepare_custom_path()
  4. 7 themekey_build.inc \themekey_prepare_custom_path()
  5. 7.2 themekey_build.inc \themekey_prepare_custom_path()

Extracts named wildcards from paths entered as value in a ThemeKey rule with property drupal:path.

Parameters

$path: path as string

Return value

array containing two elements:

  • path with unnamed wildcards
  • named wildcards as array
1 call to themekey_prepare_custom_path()
themekey_rule_set in ./themekey_build.inc
Stores ThemeKey rules in database. It creates a new dataset or updates an existing one.

File

./themekey_build.inc, line 247
The functions in this file are the back end of ThemeKey which should be used only if you configure something but not when ThemeKey switches themes.

Code

function themekey_prepare_custom_path($path) {
  $wildcards = array();
  $parts = explode('/', $path, MENU_MAX_PARTS);
  foreach ($parts as $index => $part) {
    if (preg_match('/^(\\%|\\#)([a-z0-9_:]*)$/', $part, $matches)) {
      $parts[$index] = $matches[1];
      if (!empty($matches[2])) {
        $wildcards[$index] = $matches[2];
      }
    }
  }
  $path = implode('/', $parts);
  return array(
    $path,
    $wildcards,
  );
}