function hook_entity_hierarchy_microsite_links_alter in Entity Reference Hierarchy 3.x
Same name and namespace in other branches
- 8.2 modules/entity_hierarchy_microsite/entity_hierarchy_microsite.api.php \hook_entity_hierarchy_microsite_links_alter()
Allows modules to alter the microsite menu links.
Parameters
array $links: The link definitions to be altered.
1 function implements hook_entity_hierarchy_microsite_links_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- entity_hierarchy_microsite_test_entity_hierarchy_microsite_links_alter in modules/
entity_hierarchy_microsite/ tests/ modules/ entity_hierarchy_microsite_test/ entity_hierarchy_microsite_test.module - Implements hook_entity_hierarchy_microsite_links_alter().
File
- modules/
entity_hierarchy_microsite/ entity_hierarchy_microsite.api.php, line 30 - Contains documentation for module APIs.
Code
function hook_entity_hierarchy_microsite_links_alter($links) {
// Disable all test node links in the microsite menu.
foreach ($links as $key => $link) {
if (empty($link['menu_name']) || $link['menu_name'] !== 'entity-hierarchy-microsite') {
continue;
}
if (empty($link['options']['entity']) || !($node = $link['options']['entity']) || !$node instanceof \Drupal\node\NodeInterface || $node
->bundle() !== 'test') {
continue;
}
$links[$key]['enabled'] = 0;
}
}