function menu_ui_token_info in Token 8
Implements hook_token_info() on behalf of menu_ui.module.
File
- ./
token.tokens.inc, line 1288 - Token callbacks for the token module.
Code
function menu_ui_token_info() {
// Menu tokens.
$info['types']['menu'] = [
'name' => t('Menus'),
'description' => t('Tokens related to menus.'),
'needs-data' => 'menu',
];
$info['tokens']['menu']['name'] = [
'name' => t('Name'),
'description' => t("The name of the menu."),
];
$info['tokens']['menu']['machine-name'] = [
'name' => t('Machine-readable name'),
'description' => t("The unique machine-readable name of the menu."),
];
$info['tokens']['menu']['description'] = [
'name' => t('Description'),
'description' => t('The optional description of the menu.'),
];
$info['tokens']['menu']['menu-link-count'] = [
'name' => t('Menu link count'),
'description' => t('The number of menu links belonging to the menu.'),
];
$info['tokens']['menu']['edit-url'] = [
'name' => t('Edit URL'),
'description' => t("The URL of the menu's edit page."),
];
$info['tokens']['menu-link']['menu'] = [
'name' => t('Menu'),
'description' => t('The menu of the menu link.'),
'type' => 'menu',
];
$info['tokens']['menu-link']['edit-url'] = [
'name' => t('Edit URL'),
'description' => t("The URL of the menu link's edit page."),
];
if (\Drupal::moduleHandler()
->moduleExists('node')) {
$info['tokens']['node']['menu-link'] = [
'name' => t('Menu link'),
'description' => t("The menu link for this node."),
'type' => 'menu-link',
];
}
return $info;
}