TestContextualLink.php

Same filename in other branches
  1. 8.9.x core/modules/system/tests/modules/menu_test/src/Plugin/Menu/ContextualLink/TestContextualLink.php
  2. 10 core/modules/system/tests/modules/menu_test/src/Plugin/Menu/ContextualLink/TestContextualLink.php
  3. 11.x core/modules/system/tests/modules/menu_test/src/Plugin/Menu/ContextualLink/TestContextualLink.php

Namespace

Drupal\menu_test\Plugin\Menu\ContextualLink

File

core/modules/system/tests/modules/menu_test/src/Plugin/Menu/ContextualLink/TestContextualLink.php

View source
<?php

namespace Drupal\menu_test\Plugin\Menu\ContextualLink;

use Drupal\Core\Menu\ContextualLinkDefault;
use Symfony\Component\HttpFoundation\Request;

/**
 * Defines a contextual link plugin with a dynamic title from user input.
 */
class TestContextualLink extends ContextualLinkDefault {
    
    /**
     * {@inheritdoc}
     */
    public function getTitle(Request $request = NULL) {
        return "<script>alert('Welcome to the jungle!')</script>";
    }

}

Classes

Title Deprecated Summary
TestContextualLink Defines a contextual link plugin with a dynamic title from user input.

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