root / drupal7 / sites / all / modules / pathauto / pathauto.api.php @ 384fc62a
1 |
<?php
|
---|---|
2 |
|
3 |
/**
|
4 |
* @file
|
5 |
* Documentation for pathauto API.
|
6 |
*
|
7 |
* @see hook_token_info
|
8 |
* @see hook_tokens
|
9 |
*/
|
10 |
|
11 |
function hook_path_alias_types() { |
12 |
} |
13 |
|
14 |
function hook_pathauto($op) { |
15 |
} |
16 |
|
17 |
/**
|
18 |
* Alter Pathauto-generated aliases before saving.
|
19 |
*
|
20 |
* @param string $alias
|
21 |
* The automatic alias after token replacement and strings cleaned.
|
22 |
* @param array $context
|
23 |
* An associative array of additional options, with the following elements:
|
24 |
* - 'module': The module or entity type being aliased.
|
25 |
* - 'op': A string with the operation being performed on the object being
|
26 |
* aliased. Can be either 'insert', 'update', 'return', or 'bulkupdate'.
|
27 |
* - 'source': A string of the source path for the alias (e.g. 'node/1').
|
28 |
* This can be altered by reference.
|
29 |
* - 'data': An array of keyed objects to pass to token_replace().
|
30 |
* - 'type': The sub-type or bundle of the object being aliased.
|
31 |
* - 'language': A string of the language code for the alias (e.g. 'en').
|
32 |
* This can be altered by reference.
|
33 |
* - 'pattern': A string of the pattern used for aliasing the object.
|
34 |
*/
|
35 |
function hook_pathauto_alias_alter(&$alias, array &$context) { |
36 |
// Add a suffix so that all aliases get saved as 'content/my-title.html'
|
37 |
$alias .= '.html'; |
38 |
|
39 |
// Force all aliases to be saved as language neutral.
|
40 |
$context['language'] = LANGUAGE_NONE; |
41 |
} |
42 |
|
43 |
/**
|
44 |
* Alter the list of punctuation characters for Pathauto control.
|
45 |
*
|
46 |
* @param $punctuation
|
47 |
* An array of punctuation to be controlled by Pathauto during replacement
|
48 |
* keyed by punctuation name. Each punctuation record should be an array
|
49 |
* with the following key/value pairs:
|
50 |
* - value: The raw value of the punctuation mark.
|
51 |
* - name: The human-readable name of the punctuation mark. This must be
|
52 |
* translated using t() already.
|
53 |
*/
|
54 |
function hook_pathauto_punctuation_chars_alter(array &$punctuation) { |
55 |
// Add the trademark symbol.
|
56 |
$punctuation['trademark'] = array('value' => '™', 'name' => t('Trademark symbol')); |
57 |
|
58 |
// Remove the dollar sign.
|
59 |
unset($punctuation['dollar']); |
60 |
} |