path alias

Code for creating path alias token


/**
* Implementation of hook_token_list().
*/
function gmapnode_token_list(
$type = 'all') {
if($type == 'taxonomy' || $type == 'all') {
$tokens['taxonomy']['catpath-raw-not-self'] = t('As [cat-raw], but including its supercategories separated by /. NOT INCLUDING ITSELF! WARNING - raw user input.');
return $tokens;
}
elseif($type == 'node') {
$tokens['node']['termfirst-leaf-catpath-raw'] = t('Unfiltered path of the first leaf term.

Add bulk generate URL alias via pathauto function

If you have access to your own module you can add a hook_cron function with the following code. On each cron it will execute the bulk generation for nodes

<?php
function feed_control_cron(){
   
   
//If you want to change the number of nodes to change
   
variable_set('pathauto_max_bulk_update', 1000);
   
   
//include the .inc files of pathauto
   
_pathauto_include();

   
//Executes the generation of URL aliases for nodes
   
node_pathauto_bulkupdate();
}
?>

Other solutions: http://drupal.org/node/236304

A way of hook Drupal pathauto

This is a way, not very nice though, to hook pathauto. It is called when someone view or save the settings of URL alias at admin/build/path/pathauto. The module_invoke_all() is called in the function pathauto_admin_settings(), so this function has to be named "..._pathauto". This is not a ready to use script, even if I have used it on a production site.

Node path to path alias array

Convert Drupal node path, "node/123.." to path alias and store it in an array. Useful when you have conditions based on path alias in your module or template files.

<?php
 
//Get path alias from arg() function and back to array
 
$path = implode('/',arg());
 
$path_alias = drupal_get_path_alias($path);
 
$arg = explode('/', $path_alias);

 
$show_path = array("knowledgebase", "knowledge", "search", "convert", "extract", "password");
 
  if (
in_array($arg[0], $show_path)) {
    
//Do something...
 
}

?>