farm_ui_menu.module in farmOS 2.x
The farmOS UI Menu module.
File
modules/core/ui/menu/farm_ui_menu.moduleView source
<?php
/**
* @file
* The farmOS UI Menu module.
*/
use Drupal\farm_ui_menu\Render\Element\FarmAdminToolbar;
/**
* Implements hook_menu_links_discovered_alter().
*/
function farm_ui_menu_menu_links_discovered_alter(&$links) {
// Move the root system.admin menu link to the farm.base parent.
if (!empty($links['system.admin'])) {
$links['system.admin']['parent'] = 'farm.base';
$links['system.admin']['weight'] = 100;
}
// Move the farm.report menu link to the farm.base parent.
if (!empty($links['farm.report'])) {
$links['farm.report']['parent'] = 'farm.base';
$links['farm.report']['weight'] = 90;
}
// Move the farm.quick:farm.quick menu link to the farm.base parent.
if (!empty($links['farm.quick:farm.quick'])) {
$links['farm.quick:farm.quick']['parent'] = 'farm.base';
}
}
/**
* Implements hook_toolbar_alter().
*/
function farm_ui_menu_toolbar_alter(&$items) {
// Override the toolbar tray prerender method to use farm.base root.
$items['administration']['tray']['toolbar_administration']['#pre_render'] = [
[
FarmAdminToolbar::class,
'preRenderTray',
],
];
}
Functions
Name | Description |
---|---|
farm_ui_menu_menu_links_discovered_alter | Implements hook_menu_links_discovered_alter(). |
farm_ui_menu_toolbar_alter | Implements hook_toolbar_alter(). |