You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was having some really weird behaviour in trying to put together a BuildTask that populates some required pages and migrates some page classes for a change I'm making to an existing website. It turns out there were two things causing me trouble.
My get() calls to check for existing pages were behaving differently depending on the last Subsite I accessed in the CMS.
My create() calls were creating pages in different places depending on the last Subsite I accessed in the CMS.
The solution was to add Subsite::changeSubsite(0); and Subsite::disable_subsite_filter(); to the top of my run() method in the build task.
It took trial and error and reading through code and Issues to find the solution, but I think this behaviour and the disable method could be called out in the docs to prevent this kind of frustration.
If and when I get the time I may submit a PR on the README myself, but it might be better from someone more familiar with the particulars of this module.
The text was updated successfully, but these errors were encountered:
Hey Dave, the Subsite::disable_subsite_filter() / Subsite::disable_subsite_filter() methods are a pretty important escape hatch for projects using Subsites, so I agree that the docs should cover their use. We'd happily accept a PR for this :)
I was having some really weird behaviour in trying to put together a BuildTask that populates some required pages and migrates some page classes for a change I'm making to an existing website. It turns out there were two things causing me trouble.
get()
calls to check for existing pages were behaving differently depending on the last Subsite I accessed in the CMS.create()
calls were creating pages in different places depending on the last Subsite I accessed in the CMS.The solution was to add
Subsite::changeSubsite(0);
andSubsite::disable_subsite_filter();
to the top of myrun()
method in the build task.It took trial and error and reading through code and Issues to find the solution, but I think this behaviour and the disable method could be called out in the docs to prevent this kind of frustration.
If and when I get the time I may submit a PR on the README myself, but it might be better from someone more familiar with the particulars of this module.
The text was updated successfully, but these errors were encountered: