class MenuOperationsLinkTestHooks
Hook implementations for menu_operations_link_test.
Hierarchy
- class \Drupal\menu_operations_link_test\Hook\MenuOperationsLinkTestHooks
Expanded class hierarchy of MenuOperationsLinkTestHooks
File
-
core/
modules/ menu_link_content/ tests/ menu_operations_link_test/ src/ Hook/ MenuOperationsLinkTestHooks.php, line 15
Namespace
Drupal\menu_operations_link_test\HookView source
class MenuOperationsLinkTestHooks {
/**
* Implements hook_entity_operation_alter().
*/
public function entityOperationAlter(array &$operations, EntityInterface $entity) {
if (!$entity instanceof MenuLinkContent) {
return;
}
// Alter the title of the edit link appearing in operations menu.
$operations['edit']['title'] = t('Altered Edit Title');
}
/**
* Implements hook_entity_operation().
*/
public function entityOperation(EntityInterface $entity) {
if (!$entity instanceof MenuLinkContent) {
return;
}
$operations['custom_operation'] = [
'title' => t('Custom Home'),
'weight' => 20,
'url' => Url::fromRoute('<front>'),
];
return $operations;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
MenuOperationsLinkTestHooks::entityOperation | public | function | Implements hook_entity_operation(). |
MenuOperationsLinkTestHooks::entityOperationAlter | public | function | Implements hook_entity_operation_alter(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.