annotate sites/all/modules/pathauto/pathauto.api.php @ 0:ff03f76ab3fe

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