public function UltimenuManager::getRegionKey in Ultimenu 8
Gets the region key.
Parameters
string $menu_name: The menu name.
string $key: The menu item key can be UUID or menu item title.
string $title: The menu item title.
string $max_length: The maximum characters to trim.
Return value
string The region key name based on shortened UUID, or menu item title.
Overrides UltimenuManagerInterface::getRegionKey
2 calls to UltimenuManager::getRegionKey()
- UltimenuManager::buildMenuTree in src/
UltimenuManager.php - Build the menu to contain Ultimenu regions.
- UltimenuManager::getRegions in src/
UltimenuManager.php - The array of available Ultimenu regions based on enabled menu items.
File
- src/
UltimenuManager.php, line 240
Class
- UltimenuManager
- Manages Ultimenu plugin.
Namespace
Drupal\ultimenuCode
public function getRegionKey($menu_name, $key, $title, $max_length = 28) {
$goodies = $this
->getSetting('goodies');
$is_mlid = isset($goodies['ultimenu-mlid']) && $goodies['ultimenu-mlid'];
$is_hash = isset($goodies['ultimenu-mlid-hash']) && $goodies['ultimenu-mlid-hash'];
$menu_name = $this
->truncateRegionKey($menu_name, $max_length);
if ($is_hash) {
$menu_item = $this
->getShortenedHash($key);
}
elseif ($is_mlid) {
$menu_item = $this
->getShortenedUuid($key);
}
else {
$menu_item = $this
->truncateRegionKey(strip_tags($title), $max_length);
}
return 'ultimenu_' . $menu_name . '_' . $menu_item;
}