You are here

function nodehierarchy_update_7200 in Node Hierarchy 7.2

Same name and namespace in other branches
  1. 7.4 nodehierarchy.install \nodehierarchy_update_7200()

Replace the pathauto tokens which have changed format.

File

./nodehierarchy.install, line 155
Install file for nodehierarchy module.

Code

function nodehierarchy_update_7200() {
  $replace = array(
    '[fullhierarchypath]' => '[node:nodehierarchy:parent:url:alias]/[node:title]',
    '[hierarchypath]' => '[node:nodehierarchy:parent:url:alias]',
    '[hierarchyparenttitle]' => '[node:nodehierarchy:parent:title]',
    '[hierarchyparenttitle-raw]' => '[node:nodehierarchy:parent:title]',
    '[hierarchyparentnid]' => '[node:nodehierarchy:parent:nid]',
    '[hierarchytitlepath]' => '[node:nodehierarchy:parent:url:alias]',
    '[hierarchytitlepath-raw]' => '[node:nodehierarchy:parent:url:alias]',
    '[fullhierarchytitlepath]' => '[node:nodehierarchy:parent:url:alias]/[node:title]',
    '[fullhierarchytitlepath-raw]' => '[node:nodehierarchy:parent:url:alias]/[node:title]',
  );
  foreach (node_type_get_types() as $key => $type) {
    variable_set("pathauto_node_{$key}_pattern", strtr(variable_get("pathauto_node_{$key}_pattern", ''), $replace));
  }
  variable_set("pathauto_node_pattern", strtr(variable_get("pathauto_node_pattern", ''), $replace));
}