custom_url_rewrite_outbound

  1. drupal
    1. drupal6 core.php
    2. drupal7
Versionen
drupal6 – drupal7 custom_url_rewrite_outbound(&$path, &$options, $original_path)

custom_url_rewrite_outbound is not a hook, it's a function you can add to settings.php to alter all links generated by Drupal. This function is called from url(). This function is called very frequently (100+ times per page) so performance is critical.

This function should change the value of $path and $options by reference.

Übergabeparameter

$path The alias of the $priginal_path as defined in the database. If there is no match in the database it'll be the same as $original_path

$options An array of link attributes such as querystring and fragment. See url().

$orignal_path The unaliased Drupal path that is being linked to.

Verwandte Themen

▾ 1 function calls custom_url_rewrite_outbound()

url in includes/common.inc
Generate a URL from a Drupal menu path. Will also pass-through existing URLs.

Code

modules/system/system.api.php, line 1034

<?php
function custom_url_rewrite_outbound(&$path, &$options, $original_path) {
  global $user;

  // Change all 'node' to 'article'.
  if (preg_match('|^node(/.*)|', $path, $matches)) {
    $path = 'article' . $matches[1];
  }
  // Create a path called 'e' which lands the user on her profile edit page.
  if ($path == 'user/' . $user->uid . '/edit') {
    $path = 'e';
  }

}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen