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
While contemplating 16199, I was thinking that there must be a better way to handle global blocks (and global content in general), a topic that has been broadly discussed in Discord, with no globaly (pun intented) accepted solution.
Currently, my personally preffered solution is to use a "global blocks" section and use an entries field inside a matrix entry to fetch global blocks (entries) as described in my comment. Essentially this is a mix of the new nested Matrix and Justin's method of global entries.
While this works and is flexible, it still has problems:
You can't easily search content linked via an entries field.
You can't edit the entry inline in an entries field.
If you were able to edit the entry inline the author would probably be confused when the content was changed globaly.
If you want to use a "global" entry as a source for fallbacks/defaults in a "local" entry, you need additional logic and fields in your "local" entries.
If the content in an entry is mostly linked global entries, as described by humandevs in 16199, the "ownership" of that content feels a bit muddled. Is it global only or does it also belong to the entry? Or both?
After some thinking I have a proposal to add the ability for matrix fields to have - in addition to blocks (nested entries) - entry instances:
The entry instance would be a duplicate of an existing entry that is created on the spot, as a matrix entry, and would store its "relation" with the master entry.
Master entries should not live inside a matrix (since they are meant to be of global scope), but should be able to be cloned on the spot from a matrix entry if needed and placed in a section, and then the matrix entry should become an entry instance.
The entry instance would be editable but would also be able to push or pull changes from/to the master entry.
The master entry would be able to push changes to all its instaces (effectivelly reverting all local changes in them).
Pushing and pulling would replace all content, to keep things simple, but maybe merging of changes could be added in a future iteration if this feature gets implemented.
Master entries and entry instances would idealy be marked as such in the UI with links to "master/instance" relations.
Benefits:
All entry instances will be owned by their local owner entry: they would be essentially Matrix entries with some added powers.
Since they belong to the local owner, they will be easily searchable.
Since they can use the matrix editing UI, they can be editable inline.
Pushing/synching would be manual, so no accidental changes to global content or vice versa.
Local content deviations could be easily made and easily reverted.
One last thing: There's no reason entry instances should only be used inside Matrix, that's just a made-up limitation. For example "Master entries" could be used as "Template entries" for any new entry, in any section, and have the same pushing/pulling capabilities.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
While contemplating 16199, I was thinking that there must be a better way to handle global blocks (and global content in general), a topic that has been broadly discussed in Discord, with no globaly (pun intented) accepted solution.
Before Craft 5, a decent approach was Justin Holts' "Using Entries and Relationships as a content builder system".
Currently, my personally preffered solution is to use a "global blocks" section and use an entries field inside a matrix entry to fetch global blocks (entries) as described in my comment. Essentially this is a mix of the new nested Matrix and Justin's method of global entries.
While this works and is flexible, it still has problems:
After some thinking I have a proposal to add the ability for matrix fields to have - in addition to blocks (nested entries) - entry instances:
Benefits:
One last thing: There's no reason entry instances should only be used inside Matrix, that's just a made-up limitation. For example "Master entries" could be used as "Template entries" for any new entry, in any section, and have the same pushing/pulling capabilities.
Thanks for reading this, hope it makes sense!
Beta Was this translation helpful? Give feedback.
All reactions