function hook_path_update
Same name in other branches
- 7.x 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
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();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.