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
For the SiteCopy (https://github.com/Goldinteractive/craft3-sitecopy) to enable copying from one site to another we use the getSerializedFieldValues method on the entry to get the serialized form of the field layout to save it to another entry.
The problem is that the method does not return deactivated blocks (It just skips them).
For the copying this isn't nice but not a catastrophic error, except if you have a multi level structure and only the parent is deactivated but not the children then what happens is that the method getSerializedFieldValues returns the children but not the parent.
If we use the result of the method and save it to another entry we lose the parent block and the neo structure is broken/wrong.
Example with an accordion. We have a accordion wrapper which has the entries as its children:
Level 1: Accordion
Level 2 (Children): Accordion entry
After using the result from getSerializedFieldValues the structure will be:
Accordion entry 1
-- Accordion entry 2
We lost the parent block "Accordion" and the funny thing is the child blocks are not on the same level anymore. If you open the entry it will take the first child and use it as a parent.
From the returned data from getSerializedFieldValues you would expect this:
Accordion entry 1
Accordion entry 2
But that does not happen.
getSerializedFieldValues should always return all the blocks no matter the status of the corresponding block and especially it should not create a bogus structure.
Any inputs/opinions on this? I hope my report is comprehensible. :D
Other information
Neo version: 2.7.24
Craft version: 3.4.29.1
The text was updated successfully, but these errors were encountered:
christianruhstaller
changed the title
getSerializedFieldValues on entry does not return deactivated blocks and breaks block structure
getSerializedFieldValues() on entry does not return deactivated blocks and breaks block structure
Aug 12, 2020
I explained in a bit more detail in #372 how the behaviour of a Neo field's serializeValue() method is consistent with Matrix and structure section entry queries, and why serializeValue()'s return value should therefore not be considered reliable structure data if only enabled blocks are included. That said, I did also discuss whether enabled blocks should be excluded when querying for enabled blocks if they have a disabled ancestor; at this point (for consistency with structure section entry queries) I'm inclined to leave it as it is, but it's worth considering.
I think disabled blocks should be returned by getSerializedFieldValues() -- or at least have the option to set that -- and that the ideal solution to this would be if we could set anyStatus() on the block query if getSerializedFieldValues() is involved, but that doesn't seem possible at the moment as far as I can tell.
Description
For the SiteCopy (https://github.com/Goldinteractive/craft3-sitecopy) to enable copying from one site to another we use the
getSerializedFieldValues
method on the entry to get the serialized form of the field layout to save it to another entry.The problem is that the method does not return deactivated blocks (It just skips them).
For the copying this isn't nice but not a catastrophic error, except if you have a multi level structure and only the parent is deactivated but not the children then what happens is that the method
getSerializedFieldValues
returns the children but not the parent.If we use the result of the method and save it to another entry we lose the parent block and the neo structure is broken/wrong.
Example with an accordion. We have a accordion wrapper which has the entries as its children:
Level 1: Accordion
Level 2 (Children): Accordion entry
Entry:
Neo field:
-- Accordion entry 1
-- Accordion entry 2
After using the result from
getSerializedFieldValues
the structure will be:-- Accordion entry 2
We lost the parent block "Accordion" and the funny thing is the child blocks are not on the same level anymore. If you open the entry it will take the first child and use it as a parent.
From the returned data from
getSerializedFieldValues
you would expect this:But that does not happen.
getSerializedFieldValues
should always return all the blocks no matter the status of the corresponding block and especially it should not create a bogus structure.Any inputs/opinions on this? I hope my report is comprehensible. :D
Other information
The text was updated successfully, but these errors were encountered: