eZ Community » Forums » eZ Publish 5 Platform » XML block content
expandshrink

XML block content

XML block content

Wednesday 22 May 2013 1:00:10 pm - 4 replies

Hi,

is it possible to check inside a (twig)template if a xml block has content?...something likeĀ {% if content.getField('whatever').value != NULL %}

thanks in advance

Thursday 23 May 2013 11:10:38 am

Hi Patrick,

You can use the method isEmptyValue( $fieldValue ) on your field type, to check if the value is empty or not.

Thursday 23 May 2013 6:03:43 pm

Hi Edi,

could you please provide an example?
How can I get the fieldtype you mentioned from my contentobject?

thanks

Friday 24 May 2013 1:20:41 pm

ok i finally figured out how i can check if a xml field is empty inside the templates...

content.getField('randomxmlfield').value.xml|xmltext_to_html5 will return NULL if there's no text inside a xmlfield.

Thursday 18 July 2013 11:52:37 am

Is this best practice?

content.getField('randomxmlfield').value.xml|xmltext_to_html5

I think there sholud be a better way, shouldn't it?

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from