function pathauto_menu_get_placeholders in Pathauto 5
Generate the menu placeholders.
Parameters
$in: Numeric input is treated a menu-id, strings as src-paths.
Return value
array() with [menu] and [menupath] placeholders
1 call to pathauto_menu_get_placeholders()
File
- ./
pathauto_menu.inc, line 38 - This is pathauto_menu.inc, an submodule for pathauto.module
Code
function pathauto_menu_get_placeholders($in) {
global $_menu;
$trail = array();
$placeholders = array();
$mid = pathauto_menu_get_mid($in);
while ($mid && $_menu['visible'][$mid]) {
array_unshift($trail, pathauto_cleanstring($_menu['visible'][$mid]['title']));
$mid = $_menu['visible'][$mid]['pid'];
}
if (!empty($trail)) {
$placeholders[t('[menu]')] = array_shift($trail);
}
else {
$placeholders[t('[menu]')] = '';
}
if (!empty($trail)) {
$placeholders[t('[menupath]')] = implode('/', $trail);
}
else {
$placeholders[t('[menupath]')] = '';
}
return $placeholders;
}