function menu_item_extras_entity_view_alter in Menu Item Extras 8.2
Implements hook_entity_view_alter().
Removes default menu link fields from render.
See also
File
- ./
menu_item_extras.module, line 340 - Manage fields for the menu items.
Code
function menu_item_extras_entity_view_alter(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display) {
// Disable rendering of standard entity fields for menu link content.
if ($entity
->getEntityTypeId() === 'menu_link_content') {
$hidden_fields = [
'title',
'description',
'weight',
'expanded',
'enabled',
];
foreach ($hidden_fields as $hidden_field) {
$build[$hidden_field]['#access'] = FALSE;
}
}
}