Problem/Motivation

Routing by PHP attributes was introduced in #3311365: Use PHP attributes for route discovery. This makes use of the Symfony\Component\Routing\Attribute\Route attribute class, and for a lot of routes, the title is defined like so:

#[Route(
  // ...
  defaults: ['_title' => new TranslatableMarkup('Basic site settings')],
)]

We could do some DX improvements with a Drupal subclass of Route that has title as a constructor property (likely typed to TranslatableMarkup, or maybe string|Stringable would be better, accounting for tests), and then make use of that attribute in route definitions.

It's best to come up with a comprehensive list of commonly used properties in Drupal routes that we can add to the class constructor, because adding named arguments later can make it complicated for contrib to do BC.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

godotislate created an issue. See original summary.

godotislate’s picture

Status: Active » Closed (duplicate)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.