We currently use yaml discovery for both routing and info files, yet they do not share code past the symfony yaml parser. This makes it more difficult for other subsystems that want to use yaml discovery as well as coupling the code that handles routing and info files to yaml unnecessarily.
The need for a generic component has come up in other issues (#2005716: Remove entity dependency on plugins, promote EntityType to a domain object, #2050227: Add local action plugin deriver to use YAML discovery for static definitions), so I think it's time we added this.
The attached patch is extracted from what I wrote for #2005716: Remove entity dependency on plugins, promote EntityType to a domain object.
Here's an example of how it'd be used:
<?php
// Finds and parses all modulename.somename.yml files
$directories = $this->moduleHandler->getModuleDirectories();
$discovery = new YamlDiscovery("somename", $this->directories());
$discoverable_things = $discovery->findAll();
?>
Attachment | Size | Status | Test result | Operations |
---|---|---|---|---|
yaml_discovery.patch | 3.41 KB | Idle | PASSED: [[SimpleTest]]: [MySQL] 57,468 pass(es). | View details | Re-test |