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
Adds a new enabledByOwner element query param, which maps to a new elements_sites.enabledByOwner column. The column keeps track of whether the element/site’s owner element is enabled (recursively).
A little stumped on the most efficient way to bulid out the Elements::updateNestedEnabledByOwnerValues() method. I was thinking it could reference the elements_owners table directly to find nested elements, and be called recursively when nested enabledByOwner values differ from the passed-in $enabledByOwner value. But we don’t want to do that for nested elements that aren’t primarily owned by the saved element. E.g. if you create a draft and its nested element ownerships are duplicated for the draft, then disabled the draft, you wouldn’t want the nested elements’ enabledByOwner values set to false.
I considered only calling updateNestedEnabledByOwnerValues() when a canonical element is saved, but that would fail in the following situation:
Create an enabled entry with a Matrix field.
Create a draft for the entry.
Disable the owner entry draft.
Create a new nested entry within the Matrix field. (enabledByOwner = false)
Enable the owner entry draft. (Nested entry’s enabledByOwner value is left alone as false because $element isn’t canonical.)
Apply the draft.
In this situation, the entry’s enabled value wouldn’t appear to have changed, so there would be no need to call updateNestedEnabledByOwnerValues(), so the nested entry’s enabledByOwner stays set to false.
So either:
we call updateNestedEnabledByOwnerValues() every time an element is saved, regardless of whether its status changed; or
we have a way of tracking primary element owners within the elements_owners table, so we know which nested elements’ enabledByOwner values to update for any given save.
Option 2 would be more performant, but would also require a new primary column added to elements_owners (or a primaryOwnerId column added to elements), and expect that all plugins that implement nested elements add a migration to set those values correctly for this feature to work.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a new
enabledByOwnerelement query param, which maps to a newelements_sites.enabledByOwnercolumn. The column keeps track of whether the element/site’s owner element is enabled (recursively).Related issues