In looking through core.services.yml it seems like there's a lot of stuff in there we could benefit from being better-discoverable. In talking to jhodgdon about this, she recommended creating a feature request here about that.
Just like we have a list at https://api.drupal.org/api/drupal/functions/8 it'd be great to have one like this about services. Columns could be (examples):
- Name: router.route_provider
- Class: Drupal\Core\Routing\RouteProvider (linked to the class)
- Tags: name: event_subscriber <-- in my absolute perfect sunshine rainbow happy world, this would link to a list of all services tagged as "event_subscriber"
Comments
Comment #1
jhodgdonI'm not sure about making the tags into a link, but we could have a "contains" filter on the tags column, similar to what we have on "namespace contains" etc. on the Classes page on api.drupal.org.
Anyway, consider this requested.
Comment #2
jhodgdonActually a list of routes would be useful too, and it would be useful if both routes and services were API module documentation "items", so that they could have individual lists of "100 functions reference this service" etc.
Comment #3
jhodgdonOK, we don't need a list of all the routes (they are not reused much), but having routes and services be individual "items" would be good so that we can get individual "100 places use this" listings for both.
Comment #4
jhodgdonI'm working on this one.
Comment #6
jhodgdonI just made a commit for the first part of this: listing out the services and making item pages for services. That part is working and has tests.
I'm leaving this open and continuing to work on it though, as it needs more linking:
- If a function references 'name.of.a.service', it should link to that service's page. Currently it links to the YML file that defines the service.
- Conversely, the other way: Right now if you go to core.services.yml on my test site, you see "1467 string references to YAML keys in core.services.yml" -- eek! That is not useful. So what I want to do is take the string references to individual services out of that list, and show them on the services page, so you would see something like "20 references to cache.whatever" on the cache.whatever service page instead, which is way more useful.
- The class page should have a link back to the service that uses it.
Comment #7
jhodgdonLatest commit: Link back from class page to service that uses it.
Comment #9
jhodgdonNext commit: the rest of comment #6 (will commit shortly, as soon as the tests are finished).
The only other thing I can think of is that the tags are not currently listed on the Services listing page. It would be nice to list them, and to allow filtering. I'm going to see if I can make this happen.
Comment #11
jhodgdonOK, I figured out the tags, and this is committed too. This issue is done!
Comment #13
webchickOh, wow, great!! Where do you go to see it?
Comment #14
jhodgdonIt isn't deployed yet. Waiting on a critical issue in grammar_parser.