You are here

function hook_path_update in Drupal 8

Same name and namespace in other branches
  1. 7 modules/path/path.api.php \hook_path_update()

Respond to a path being updated.

Parameters

array $path: The array structure is identical to that of the return value of \Drupal\Core\Path\AliasStorageInterface::save().

Deprecated

in drupal:8.8.0 and is removed from drupal:9.0.0. Use hook_path_alias_update() instead.

See also

https://www.drupal.org/node/3013865

Related topics

1 function implements hook_path_update()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

path_deprecated_test_path_update in core/modules/system/tests/modules/path_deprecated_test/path_deprecated_test.module
Implements hook_path_update().

File

core/modules/path/path.api.php, line 46
Hooks provided by the Path module.

Code

function hook_path_update($path) {
  if ($path['alias'] != $path['original']['alias']) {
    \Drupal::database()
      ->update('mytable')
      ->fields([
      'alias' => $path['alias'],
    ])
      ->condition('pid', $path['pid'])
      ->execute();
  }
}