You are here

function trailing_slash_admin_paths_alter in Trailing Slash 7

Implements hook_admin_paths_alter().

Adds trailing slash versions of admin paths.

File

./trailing_slash.module, line 73
Adds checkbox to the Clean URLs settings form and alters outbound URLs.

Code

function trailing_slash_admin_paths_alter(&$paths) {
  $new_paths = array();
  foreach ($paths as $path => $enabled) {

    // Ignore paths that end in a wildcard (*) as these will already
    // work with trailing slashes.
    if (!preg_match('/\\*$/isD', $path)) {
      $new_path = $path;
      trailing_slash_add($new_path);

      // Only add a new admin path if the trailing slash version is
      // different.
      if ($new_path != $path) {
        $new_paths[$new_path] = $enabled;
      }
    }
  }
  $paths = array_merge($new_paths, $paths);
}