You are here

public function purl_path::rewrite in Persistent URL 6

Same name and namespace in other branches
  1. 7 includes/purl_path.inc \purl_path::rewrite()

Just need to add the value to the front of the path.

Overrides purl_processor::rewrite

1 method overrides purl_path::rewrite()
purl_pair::rewrite in includes/purl_pair.inc
Just need to add the value to the front of the path.

File

includes/purl_path.inc, line 76

Class

purl_path
Path prefixer.

Code

public function rewrite(&$path, &$options, $element) {

  // We attempt to remove the prefix from the path as a way to detect it's
  // presence. If the processor can remove itself than we're on a path alias
  // that contains our prefix. Then $alt will not be the same as the $path
  // and we won't do any rewriting.
  $alt = $this
    ->remove($path, $element);
  if ($alt == $path && !_purl_skip($element, $options)) {
    $items = empty($path) ? array() : explode('/', $path);
    array_unshift($items, $element->value);
    $path = implode('/', $items);
  }
}