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
However, in Field Manager, when we clone a field, we take the block types from the origin field, and create new block types based on those, for the new field. As such, the field is all prepped and ready to go, however this code overrides our prepped block types. Because assembleLayoutFromPost in this case will equate to null, it resets the field layout.
What I might propose is a check if the field layout is already set for the block type?
// Set each block type's field layout based on the data from Craft 3.5's field layout designer
foreach ($this->getBlockTypes() as $blockType) {
// Check if the block type already has a field layout set - no need to set it again
if (!$blockType->fieldLayout) {
$fieldLayout = $fieldsService->assembleLayoutFromPost("types.{$class}.blockTypes.{$blockType->id}");
$fieldLayout->type = $class;
$blockType->setFieldLayout($fieldLayout);
}
}
Notably, this wasn't an issue on previous versions - I can't tell you what version exactly, but I was on 2.8.14 before updating to the latest (2.9.11) and this was working
The text was updated successfully, but these errors were encountered:
Refer to issue verbb/field-manager#78
I believe this is because Neo assumes the field layout for a block type will come from POST params (using
assembleLayoutFromPost
)craft-neo/src/Field.php
Lines 603 to 608 in 2af37c2
However, in Field Manager, when we clone a field, we take the block types from the origin field, and create new block types based on those, for the new field. As such, the field is all prepped and ready to go, however this code overrides our prepped block types. Because
assembleLayoutFromPost
in this case will equate to null, it resets the field layout.What I might propose is a check if the field layout is already set for the block type?
Notably, this wasn't an issue on previous versions - I can't tell you what version exactly, but I was on 2.8.14 before updating to the latest (2.9.11) and this was working
The text was updated successfully, but these errors were encountered: