function hook_path_insert

Same name in other branches
  1. 7.x modules/path/path.api.php \hook_path_insert()

Respond to a path being inserted.

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_insert() instead.

See also

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

Related topics

1 function implements hook_path_insert()

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_insert in core/modules/system/tests/modules/path_deprecated_test/path_deprecated_test.module
Implements hook_path_insert().

File

core/modules/path/path.api.php, line 25

Code

function hook_path_insert($path) {
    \Drupal::database()->insert('mytable')
        ->fields([
        'alias' => $path['alias'],
        'pid' => $path['pid'],
    ])
        ->execute();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.