function node_pathauto in Pathauto 5
Same name and namespace in other branches
- 5.2 pathauto_node.inc \node_pathauto()
- 6.2 pathauto.module \node_pathauto()
- 6 pathauto_node.inc \node_pathauto()
- 7 pathauto.module \node_pathauto()
File
- ./
pathauto_node.inc, line 7
Code
function node_pathauto($op) {
switch ($op) {
case 'settings':
$settings = array();
$settings['module'] = 'node';
$settings['groupheader'] = t('Node path settings');
$settings['patterndescr'] = t('Default path pattern (applies to all node types with blank patterns below)');
$settings['patterndefault'] = t('[title]');
$settings['supportsfeeds'] = 'feed';
$settings['bulkname'] = t('Bulk update node paths');
$settings['bulkdescr'] = t('Generate aliases for all existing nodes which do not already have aliases.');
$settings['placeholders'] = array(
t('[title]') => t('The title of the node, with spaces and punctuation replaced by the separator.'),
t('[nid]') => t('The id number of the node.'),
t('[user]') => t('The name of the user who created the node.'),
t('[uid]') => t('The id number of the user.'),
t('[type]') => t('The node type (e.g., "page", "story", etc.).'),
t('[yyyy]') => t('The year the node was created.'),
t('[mm]') => t('The two-digit month (01-12) the node was created.'),
t('[mon]') => t('The three-letter month (jan-dec) the node was created.'),
t('[dd]') => t('The two-digit day of the month (00-31) the node was created.'),
t('[day]') => t('The three-letter day of the week (sun-sat) that the node was created.'),
t('[hour]') => t('The two-digit hour (00-23) the node was created.'),
t('[min]') => t('The two-digit minute (00-59) the node was created.'),
t('[sec]') => t('The two-digit second (00-59) the node was created.'),
t('[week]') => t('The week number (1-52) of the year the node was created.'),
);
if (module_exists('taxonomy')) {
$vocabularies = taxonomy_get_vocabularies();
if (sizeof($vocabularies) > 0) {
$settings["placeholders"][t('[vocab]')] = t("The vocabulary that the page's first category belongs to.");
$settings["placeholders"][t('[cat]')] = t('The name of the lowest-weight category that the page belongs to.');
$settings["placeholders"][t('[catpath]')] = t('As [cat], but including its supercategories.');
$settings["placeholders"][t('[catalias]')] = t('The alias for the lowest-weight category that the page belongs to. This is useful for long category names. You must first set up aliases for your categories.');
}
}
if (module_exists('book')) {
$settings["placeholders"][t('[book]')] = t('For book pages, the title of the top-level book.');
$settings["placeholders"][t('[bookpath]')] = t('For book pages, the full hierarchy from the top-level book.');
}
// Look for extensions from other modules
$placeholders = module_invoke_all('pathauto_node', 'placeholders');
$settings['placeholders'] = array_merge($settings['placeholders'], $placeholders);
$nodetypes = node_get_types();
foreach ($nodetypes as $ntype => $nodetype) {
$fieldlabel = t('Pattern for all %nodetypename paths', array(
'%nodetypename' => $nodetype->name,
));
$settings['patternitems'][$ntype] = $fieldlabel;
}
return (object) $settings;
default:
break;
}
}