Problem/Motivation
Follow up from #3311365-94: Use PHP attributes for route discovery:
Route names are used to define menu links, menu tabs and at various other places also, I think we are aiming to generate auto route names but it also kind of relates to above point, How we are going to address that?
Once we've added this feature I think we could also add attributes in place of module.links.*.yml?
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|
Issue fork drupal-3584798
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
longwaveFirst pass, incorporating #3582628: Add a generic way of scanning classes for attributes. SystemController has a *lot* of attributes now, which seems a bit weird, but it's the most complex case by far.
Comment #5
longwaveOne thing I should explicitly call out: in most cases the menu link title is the same as the default route title, so we take
titlefrom the route'sdefaults._titleproperty if the menu link didn't explicitly set one.I do wonder if we should somehow promote
defaults._titleto a top level property on the Route attribute, as it would make it all a lot easier to read.Comment #6
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #7
aaronmchaleYes! If only because now that routes can be defined via attributes, the more things that are top-level keys the more we benefit from those things being discoverable by IDEs, etc. And title is probably one of the most common keys to be defined in a route.
Comment #8
godotislateI think we'd need our own Route attribute to do that?
Comment #9
aaronmchaleOh yeah that's a really good point
Comment #10
longwaveCould we extend the Symfony one and juggle the parameters in the constructor?
Comment #11
godotislateYes, that should be pretty easy to do. In that case, we probably want to consider other top level properties we want, if any, and add them all at once. That way we reduce the need of introducing new ones later and potentially causing confusion/fatal errors on missing named parameters.
Comment #12
godotislateIssue to promote title to top level: #3607968: Promote defaults._title to top level in route attributes.