1 path.inc path_clean_token_values(array &$replacements, array $data = array(), array $options = array())

Clean tokens so they are URL friendly.

This function is a token_replace() callback, hence why $data is passed in but is not used for any reason.

Parameters

array $replacements: An array of token replacements that need to be "cleaned" for use in the URL.

array $data: An array of objects used to generate the replacements.

array $options: An array of options used to generate the replacements.

See also

path_generate_entity_alias()

token_replace()

File

core/modules/path/path.inc, line 612
Miscellaneous functions for Path module.

Code

function path_clean_token_values(array &$replacements, array $data = array(), array $options = array()) {
  foreach ($replacements as $token => $value) {
    // Only clean non-path tokens.
    if (!preg_match('/(path|alias|url|url-brief)\]$/', $token)) {
      $replacements[$token] = path_clean_string($value, $options);
    }
  }
}