TitleClosureCallback.php

Namespace

Drupal\Tests\Core\Controller

File

core/tests/Drupal/Tests/Core/Controller/TitleClosureCallback.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\Core\Controller;

use Drupal\Core\Routing\Attribute\Route;
use Drupal\Core\StringTranslation\TranslatableMarkup;

/**
 * Provides an example title closure for TitleResolverTest.
 *
 * This file intentionally contains a closure in an attribute argument, which
 * is valid only in PHP 8.5 and later. It is loaded only by the PHP-gated test.
 */
class TitleClosureCallback {
  
  /**
   * A controller with a title closure on its route attribute.
   *
   * @return array
   *   A render array.
   */
  public function example(string $value) : array {
    return [];
  }

}

Classes

Title Deprecated Summary
TitleClosureCallback Provides an example title closure for TitleResolverTest.

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