function hook_pathauto in Pathauto 7
Same name and namespace in other branches
- 6.2 pathauto.api.php \hook_pathauto()
- 6 pathauto.api.php \hook_pathauto()
Provide information about the way your module's aliases will be built.
The information you provide here is used to build the form on search/path/patterns. File pathauto.pathauto.inc provides example implementations for system modules.
Parameters
$op: At the moment this will always be 'settings'.
Return value
object|null An object, or array of objects (if providing multiple groups of path patterns). Each object should have the following members:
- 'module': The module or entity type.
- 'token_type': Which token type should be allowed in the patterns form.
- 'groupheader': Translated label for the settings group
- 'patterndescr': The translated label for the default pattern (e.g., t('Default path pattern (applies to all content types with blank patterns below)')
- 'patterndefault': Default pattern (e.g. 'content/[node:title]'
- 'batch_update_callback': The name of function that should be ran for bulk update. @see node_pathauto_bulk_update_batch_process for example
- 'batch_file': The name of the file with the bulk update function.
- 'patternitems': Optional. An array of descritpions keyed by bundles.
See also
node_pathauto
5 functions implement hook_pathauto()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- blog_pathauto in ./
pathauto.module - Implements hook_pathauto() on behalf of blog module.
- forum_pathauto in ./
pathauto.module - Implements hook_pathauto() for forum module.
- node_pathauto in ./
pathauto.module - Implements hook_pathauto() on behalf of node module.
- taxonomy_pathauto in ./
pathauto.module - Implements hook_pathauto() on behalf of taxonomy module.
- user_pathauto in ./
pathauto.module - Implements hook_pathauto() on behalf of user module.
2 invocations of hook_pathauto()
- pathauto_bulk_update_form in ./
pathauto.admin.inc - Form contructor for path alias bulk update form.
- pathauto_patterns_form in ./
pathauto.admin.inc - Form builder; Configure the URL alias patterns.
File
- ./
pathauto.api.php, line 97 - Documentation for pathauto API.
Code
function hook_pathauto($op) {
switch ($op) {
case 'settings':
$settings = array();
$settings['module'] = 'file';
$settings['token_type'] = 'file';
$settings['groupheader'] = t('File paths');
$settings['patterndescr'] = t('Default path pattern (applies to all file types with blank patterns below)');
$settings['patterndefault'] = 'files/[file:name]';
$settings['batch_update_callback'] = 'file_entity_pathauto_bulk_update_batch_process';
$settings['batch_file'] = drupal_get_path('module', 'file_entity') . '/file_entity.pathauto.inc';
foreach (file_type_get_enabled_types() as $file_type => $type) {
$settings['patternitems'][$file_type] = t('Pattern for all @file_type paths.', array(
'@file_type' => $type->label,
));
}
return (object) $settings;
default:
break;
}
}