eZ Platform Discussions

Display XML field contains in Field Class


#1

Hi,

i come back after 2/3 years on eZ and i’m looooost
i have a silly thing to do and i can’t
This is my silly thing : i have an object “eZ\Publish\API\Repository\Values\Content\Field” that is an XML Bloc and i want to display the content of this xml bloc in my template. I try with ez_render_field but nothing. I know ez_render_field just accept eZ\Publish\Core\Repository\Values\Content\Content but maybe there is an other way ?

I’m sorry but i’m really lost

Thanks


#2

Hi, sorry.

I was just really really rusted. I found a way to send a eZ\Publish\Core\Repository\Values\Content\Content to my template and i works very well.

$contentFormItem = $contentService->loadContentByContentInfo($locationItemFormItem->contentInfo);
$formItemData['formData']['content'] = $contentFormItem;
return $formItemData;

Template
{{ ez_render_field( formItemData["formData"].content, "name_html" ) }}

Thanks