function menu_operations_link_test_entity_operation

Same name in other branches
  1. 10 core/modules/menu_link_content/tests/menu_operations_link_test/menu_operations_link_test.module \menu_operations_link_test_entity_operation()

Implements hook_entity_operation().

File

core/modules/menu_link_content/tests/menu_operations_link_test/menu_operations_link_test.module, line 28

Code

function menu_operations_link_test_entity_operation(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.