Do the <sequence/>
tags in module.xml
files impact the order Magento will process layout handle XML files in? My preliminary research says no, but that seems wrong so I'm looking for confirmation/proof that they don't (proof == source code points where layout handle XML file paths are generated and loaded)
If the sequence tags don't impact layout handle XML file loading order — is there a way to change the module order these files are loaded in?
Specific problem I'm trying to solve is if I have the following loaded before the container is actually aded to the page
<referenceContainer name="product.info.media">
<action method="unsetChild">
<argument name="block" xsi:type="string">product.info.media.image</argument>
</action>
</referenceContainer>
Magento barfs.
Best Answer
The sequence in
module.xml
has an impact onapp/etc/config.php
. This file gets updated when you runbin/magento module:enable Vendor_ModuleName
so if you have added/changed sequences I'd suggest disabling your module and then re-enabling it. Updating yourmodule.xml
file and clearing your cache isn't enough here, you'll need to do a fulldisable
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
which references a page layout file collector in the same di.xml
the one that looks of interest to us is
pageLayoutFileSourceBaseSorted
still in the same di.xmlMagento\Framework\View\File\Collector\Decorator\ModuleDependency
does the following sortingwhere
moduleList
is based onMagento\Framework\Module\ModuleList
which in turn uses the Loader mentioned way above.