Details
-
Improvement
-
Resolution: Fixed
-
High
-
5.3, 5.3.5.1
Description
Trying to add a flow block via the public api. The flow block has custom attributes. When saving the flow block, there is no error, but the value of the custom attribute is not showing up in the backend.
Analysis
In my case, the custom attribute is "hide_headlines".
After a bit of debugging, i found out, that the generated XML contains
<block id="id_3475ab1760d9e00033b0cc56d66cefd5"> <name>MyName</name> <type>my_type</type> <view>default</view> <overflow_id></overflow_id> <customAttributes/> <hide_headlines>1</hide_headlines> <zone_id>a2614f21683543ec69254144dc12339d</zone_id> </block>
but it should contain
<block id="id_3475ab1760d9e00033b0cc56d66cefd5"> <name>MyName</name> <zone_id>a2614f21683543ec69254144dc12339d</zone_id> <type>my_type</type> <custom_attributes> <hide_headlines>1</hide_headlines> </custom_attributes> <view>default</view> <overflow_id></overflow_id> </block>
there seems to be a mix-up of notation (customAttributes vs. custom_attributes). Former one is used in public API when writing while latter one is used in legacy (and backend) and public API reading.
Steps to reproduce
Just copy a flow layout from one content to another.
$sourceVal = $source->getFieldValue('layout'); $contentUpdateStruct->setField('layout', $sourceVal); $contentDraft = $cntSrvc->createContentDraft($target->contentInfo); $contentDraft = $cntSrvc->updateContent($contentDraft->versionInfo, $contentUpdateStruct); $cntSrvc->publishVersion($contentDraft->versionInfo);