Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-26017

Error when rendering empty Selection field

    XMLWordPrintable

    Details

      Description

      in preview mode if Selection filed is empty (ezselection) this give an error:

      Key "0" does not exist as the array is empty in EzPublishCoreBundle::content_fields.html.twig at line 170
      500 Internal Server Error - Twig_Error_Runtime

      Frontend doesnt output the error using {{ content.getFieldValue('SELECTION-FILED-NAME') }}

      Error demo at:
      http://www.screencast.com/t/lV6J9ieLlDz

      fixing the Problem adding following condition in :
      /ezpublish-kernel/eZ/Bundle/EzPublishCoreBundle/Resources/views/content_fields.html.twig
      Line 170.

      {% elseif not fieldSettings.isMultiple %}

      {% elseif not fieldSettings.isMultiple and field.value.selection.0 is defined %}

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            da_real Ramzi Arfaoui
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: