You are here

function custom_url_rewrite in OG Vocabulary 5

If you already have a custom_url_rewrite function, please copy the contents of this one to your existing function and delete this one. See http://drupal.org/node/99927 and http://api.drupal.org/api/function/custom_url_rewrite/5.

Return value

void

File

./og_vocab.module, line 15
Give each group its own system controlled vocabularies

Code

function custom_url_rewrite($op, $result, $path) {
  if ($op == 'alias') {
    if (arg(0) == "node" && arg(2) == "og" && arg(4) == "terms") {

      // the system path to change or cloak
      $patterns[0] = '!^admin/content/taxonomy/edit/term/(\\d+)$!';

      // the new cloaked name
      $replacements[0] = 'node/' . arg(1) . '/og/vocab/edit/term/\\1';
      return preg_replace($patterns, $replacements, $path);
    }
  }
  if ($op == 'source') {

    // Do nothing.
  }

  // Do not forget to return $result!
  return $result;
}