Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
25 Jul 2013 at 14:06 UTC
Updated:
29 Jul 2014 at 22:42 UTC
Jump to comment: Most recent file
Comments
Comment #1
fubhy commentedLet's move this to Drupal\Components, add some docblocks, and write a UnitTest!
Comment #2
damiankloip commentedon it.
Comment #3
damiankloip commentedOk new patch:
- Moved the class to Component
- Added a fileBaseName method so it can easily be overridden if the pattern of dir_basename.something.yml needs to be changed
- Added a unit test with some test yml files in a Fixtures (change the name? based it on Symfony test files) folder
Comment #4
msonnabaum commentedLooks great to me.
Comment #5
dawehnerIt would be cool if there would be a single place where this functionality is actually used.
Comment #6
damiankloip commentedI'll maybe convert RouteBuilder to use this, as the other issues in the summary aren't in yet
Comment #7
msonnabaum commentedDrupalKernel would be the other option for implementation.
Comment #8
damiankloip commentedI decided to just go with the Routing example, I already had that one in my head :)
I have changed the YamlDiscovery slightly, as the return from findAll() needs to return its discovered data my the module key that was passed in with the directories array, so essentially the directory path gets replaced by an array of discovered data.
Comment #9
damiankloip commentedOh, maybe I should add back in the !empty() check on routes? or, we could add checking in the YamlDisocvery class to default to array() is nothing is returned from a file?
Comment #11
damiankloip commentedLooks like layout_test module is the only module in core to not be inside it's own folder. Moved from modules/layout/tests/layout_test.* to modules/layout/tests/layout_test/layout_test.*
Comment #13
damiankloip commentedSilly, I forgot to move all the other sub dirs for layout_test.
Comment #14
dawehnerCan't we just do $route_info += array(
'defaults' => array(),
'requirements' => array(),
'options' => array()
);
Comment #15
damiankloip commentedSure, why not. Then we just need to pass each array element into Route() params.
Also this just seems like more of a refactoring task than a feature request?
Comment #16
dawehnerThank you!
Comment #17
Crell commentedAs noted in IRC, a side-effect of this change is that the routing alter event is only called for modules that define routes, not for all modules. I consider that a bonus as it's a slight performance boost. +1 from me.
Comment #18
alexpottCommitted 03e535c and pushed to 8.x. Thanks!
Comment #20
berdirThis introduced a regression, see #2067809: YamlDiscovery uses basename of directory instead of module name