The sequence in module.xml
has an impact on app/etc/config.php
. This file gets updated when you run bin/magento module:enable Vendor_ModuleName
so if you have added/changed sequences I'd suggest disabling your module and then re-enabling it. Updating your module.xml
file and clearing your cache isn't enough here, you'll need to do a full disable
re-enable
cycle to get Magento to see sequence changes during development.
The sort order of modules in the config.php
file is then used for all other configuration file loading as per Anton's comment here.
The code locations in that comment are a bit out of date. This is the code for the sequence sorting https://github.com/magento/magento2/blob/2.0.2/lib/internal/Magento/Framework/Module/ModuleList/Loader.php#L131
Update 2:
app/etc/di.xml
<type name="Magento\Framework\View\Model\Layout\Merge">
<arguments>
<argument name="fileSource" xsi:type="object">Magento\Framework\View\Layout\File\Collector\Aggregated\Proxy</argument>
<argument name="pageLayoutFileSource" xsi:type="object">pageLayoutFileCollectorAggregated</argument>
<argument name="cache" xsi:type="object">Magento\Framework\App\Cache\Type\Layout</argument>
</arguments>
</type>
which references a page layout file collector in the same di.xml
<virtualType name="pageLayoutFileCollectorAggregated" type="Magento\Framework\View\Layout\File\Collector\Aggregated">
<arguments>
<argument name="baseFiles" xsi:type="object">pageLayoutFileSourceBaseSorted</argument>
<argument name="themeFiles" xsi:type="object">pageLayoutFileSourceThemeSorted</argument>
<argument name="overrideBaseFiles" xsi:type="object">pageLayoutFileSourceOverrideBaseSorted</argument>
<argument name="overrideThemeFiles" xsi:type="object">pageLayoutFileSourceOverrideThemeSorted</argument>
</arguments>
</virtualType>
the one that looks of interest to us is pageLayoutFileSourceBaseSorted
still in the same di.xml
<virtualType name="pageLayoutFileSourceBaseSorted" type="Magento\Framework\View\File\Collector\Decorator\ModuleDependency">
<arguments>
<argument name="subject" xsi:type="object">pageLayoutFileSourceBaseFiltered</argument>
</arguments>
</virtualType>
Magento\Framework\View\File\Collector\Decorator\ModuleDependency
does the following sorting
protected function getModulePriority($moduleName)
{
if ($this->orderedModules === null) {
$this->orderedModules = $this->moduleList->getNames();
}
$result = array_search($moduleName, $this->orderedModules);
// Assume unknown modules have the same priority, distinctive from known modules
if ($result === false) {
return -1;
}
return $result;
}
where moduleList
is based on Magento\Framework\Module\ModuleList
which in turn uses the Loader mentioned way above.