remove($q, $item); $value = $this->remove($value, $item); } /** * Removes specific modifier from a query string. * * @param $q * The current path. * @param $element * a purl_path_element object * @return path string with the modifier removed. */ public function remove($q, $element) { $args = explode('/', $q); // Remove the value from the front of the query string if (current($args) === (string) $element->value) { array_shift($args); } return implode('/', $args); } /** * Just need to add the value to the front of the path. */ 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 = explode('/', $path); array_unshift($items, $element->value); $path = implode('/', $items); } } }