Pedro Lozano Drupal developer



http

Posted by Pedro Lozano

A little trick I started using recently: using cookies to alter Drupal behavior when navigating the site (usually developing or debugging) with a shared user account that should present a different behavior to the rest of the people.

Use case. A few developers may be building a site and they all use the admin account for setup tasks. Now one of them doesn't want to see url aliases because he needs to see node ids in urls for debugging purposes.

You could put a code like this in settings.php:

function custom_url_rewrite_outbound(&$path, &$options, $original_path) {
  if ($_COOKIE['disable_url_aliases']) {
    $path = $original_path;
  }
}

Now, using a Firefox extension like Firecookie or Web Developer, you can add a cookie called disable_url_aliases in your browser that will disable url aliases only for you, the rest of the developers won't notice.



Flickr

Group photo at Drupal Commerce training in París

twitter

  • Everyone here in southern Spain complaining about been at 0ºC, it feels warm to me after coming from Paris. 1 day 21 hours ago
  • Group photo at last day of Drupal Commerce at París http://t.co/G4jk1j1y #paristraining #drupal 3 days 8 hours ago
  • It was delicious :-) @localized_fr: After #cart w/ @ryanszrama And #checkout w/ @bojan_zivanovic It's time for sushi! http://t.co/6Cm4LdvC 3 days 19 hours ago

Follow peterlozano on Twitter