You are here

function crumbs_clean_token_values in Crumbs, the Breadcrumbs suite 7

Same name and namespace in other branches
  1. 7.2 crumbs.module \crumbs_clean_token_values()

Clean tokens so they are URL friendly. Taken directly from pathauto_clean_token_values()

Parameters

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

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

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

1 string reference to 'crumbs_clean_token_values'
crumbs_CrumbsMultiPlugin_nodeParent::findParent__node_x in plugins/crumbs.crumbs.inc

File

./crumbs.module, line 582
Provides an API for building breadcrumbs.

Code

function crumbs_clean_token_values(&$replacements, $data = array(), $options = array()) {
  foreach ($replacements as $token => &$value) {

    // Only clean non-path tokens.
    if (!preg_match('/(path|alias|url|url-brief)\\]$/', $token)) {

      // We use a simple regex instead of pathauto_cleanstring().
      $value = preg_replace('#[^a-z0-9/]+#', '-', strtolower($value));
    }
  }
}