function MenuOperationsLinkTestHooks::entityOperation

Same name and namespace in other branches
  1. 11.x core/modules/menu_link_content/tests/menu_operations_link_test/src/Hook/MenuOperationsLinkTestHooks.php \Drupal\menu_operations_link_test\Hook\MenuOperationsLinkTestHooks::entityOperation()

Implements hook_entity_operation().

Attributes

#[Hook('entity_operation')]

File

core/modules/menu_link_content/tests/menu_operations_link_test/src/Hook/MenuOperationsLinkTestHooks.php, line 32

Class

MenuOperationsLinkTestHooks
Hook implementations for menu_operations_link_test.

Namespace

Drupal\menu_operations_link_test\Hook

Code

public function entityOperation(EntityInterface $entity) : array {
  if (!$entity instanceof MenuLinkContent) {
    return [];
  }
  $operations['custom_operation'] = [
    'title' => 'Custom Home',
    'weight' => 20,
    'url' => Url::fromRoute('<front>'),
  ];
  return $operations;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.