You are here

function defaultcontent_alter_path in Default Content 7

Same name and namespace in other branches
  1. 7.2 defaultcontent.module \defaultcontent_alter_path()
4 calls to defaultcontent_alter_path()
content_menu_links_features_export_render in ./defaultcontent.features.inc
Implements hook_features_export_render().
defaultcontent_alter_identifier in ./defaultcontent.module
defaultcontent_import_menu_link in ./defaultcontent.module
imports a new menu item
menu_item_export_alter in plugins/menu_item.inc
Handles the exporting of menu links attached to nodes

File

./defaultcontent.module, line 607
Module file for the Default content module which allow export and import of default content in a Drupal site.

Code

function defaultcontent_alter_path($path, $to_name = TRUE) {
  $parts = explode('/', $path);
  if ($to_name) {
    if ($parts[0] == 'node' && is_numeric($parts[1]) && ($name = defaultcontent_get_default($parts[1]))) {
      $parts[0] = 'node-name';
      $parts[1] = $name;
    }
  }
  elseif ($parts[0] == 'node-name' && !is_numeric($parts[1]) && ($nid = defaultcontent_get_default($parts[1]))) {
    $parts[0] = 'node';
    $parts[1] = $nid;
  }
  return implode('/', $parts);
}