path.api.php

Same filename in other branches
  1. 8.9.x core/modules/path/path.api.php

Hooks provided by the Path module.

File

modules/path/path.api.php

View source
<?php


/**
 * @file
 * Hooks provided by the Path module.
 */

/**
 * @addtogroup hooks
 * @{
 */

/**
 * Respond to a path being inserted.
 *
 * @param $path
 *   An associative array containing the following keys:
 *   - source: The internal system path.
 *   - alias: The URL alias.
 *   - pid: Unique path alias identifier.
 *   - language: The language of the alias.
 *
 * @see path_save()
 */
function hook_path_insert($path) {
    db_insert('mytable')->fields(array(
        'alias' => $path['alias'],
        'pid' => $path['pid'],
    ))
        ->execute();
}

/**
 * Respond to a path being updated.
 *
 * @param $path
 *   An associative array containing the following keys:
 *   - source: The internal system path.
 *   - alias: The URL alias.
 *   - pid: Unique path alias identifier.
 *   - language: The language of the alias.
 *
 * @see path_save()
 */
function hook_path_update($path) {
    db_update('mytable')->fields(array(
        'alias' => $path['alias'],
    ))
        ->condition('pid', $path['pid'])
        ->execute();
}

/**
 * Respond to a path being deleted.
 *
 * @param $path
 *   An associative array containing the following keys:
 *   - source: The internal system path.
 *   - alias: The URL alias.
 *   - pid: Unique path alias identifier.
 *   - language: The language of the alias.
 *
 * @see path_delete()
 */
function hook_path_delete($path) {
    db_delete('mytable')->condition('pid', $path['pid'])
        ->execute();
}

/**
 * @} End of "addtogroup hooks".
 */

Functions

Title Deprecated Summary
hook_path_delete Respond to a path being deleted.
hook_path_insert Respond to a path being inserted.
hook_path_update Respond to a path being updated.

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