function MenuOperationsLinkTestHooks::entityOperation

Implements 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) {
    if (!$entity instanceof MenuLinkContent) {
        return;
    }
    $operations['custom_operation'] = [
        'title' => t('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.