Skip to content
Snippets Groups Projects
Commit 4d8a96d6 authored by Dave Reid's avatar Dave Reid
Browse files

Issue #1289550: The source and language contexts could not be altered from...

Issue #1289550: The source and language contexts could not be altered from hook_pathauto_alias_alter().
parent 473680e4
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,30 @@ function hook_path_alias_types() {
function hook_pathauto($op) {
}
function hook_pathauto_alias_alter(&$alias, array $context) {
/**
* Alter Pathauto-generated aliases before saving.
*
* @param string $alias
* The automatic alias after token replacement and strings cleaned.
* @param array $context
* An associative array of additional options, with the following elements:
* - 'module': The module or entity type being aliased.
* - 'op': A string with the operation being performed on the object being
* aliased. Can be either 'insert', 'update', 'return', or 'bulkupdate'.
* - 'source': A string of the source path for the alias (e.g. 'node/1').
* This can be altered by reference.
* - 'data': An array of keyed objects to pass to token_replace().
* - 'type': The sub-type or bundle of the object being aliased.
* - 'language': A string of the language code for the alias (e.g. 'en').
* This can be altered by reference.
* - 'pattern': A string of the pattern used for aliasing the object.
*/
function hook_pathauto_alias_alter(&$alias, array &$context) {
// Add a suffix so that all aliases get saved as 'content/my-title.html'
$alias .= '.html';
// Force all aliases to be saved as language neutral.
$context['language'] = LANGUAGE_NONE;
}
/**
......
......@@ -378,10 +378,10 @@ function pathauto_create_alias($module, $op, $source, $data, $type = NULL, $lang
$context = array(
'module' => $module,
'op' => $op,
'source' => $source,
'source' => &$source,
'data' => $data,
'type' => $type,
'language' => $language,
'language' => &$language,
'pattern' => $pattern,
);
drupal_alter('pathauto_alias', $alias, $context);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment