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

Ubpublished translation's preview throws error

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • 1.10.0
    • 1.9.1, 1.7.4
    • Content > PreView
    • None

    Description

      We have a multi-language site, that has german, french and italian languages. The default language is german, siteaccesses are based on the domain (each language has different domains), the admin is usually used whith the german domain, there is no extra siteaccess for the admin.

      Step to reproduce:

      1. Create a content in the default german language, publish it.
      2. Create a translation in french, save it, don't publish it, click on the desktop preview icon in the right sidebar.
      3. There is a Symfony exception in the preview area: "Trying to get property of non-object"

      It originates from the twig template of the content where there is an ez_field_value(content, "field_name") call. The call gets to Twig's ContentExtension, where getTranslatedFieldValue() tries to get the 'value' property of that "non-object":

      $this->translationHelper->getTranslatedField($content, $fieldDefIdentifier, $forcedLanguage)->value;

      I dumped some values and the problem seems to be:

      • ez_field_value() doesn't pass a forcedLanguage
      • ContentExtenstion's getTranslatedFieldValue() calls TranslationHelper's getTranslatedField() where the getLanguages() returns the german language only (as default language)
      • The content object has only the french values loaded, so non of the getField() calls in getTranslatedField() returns Field object, therefore the getTranslatedField() returns nothing
      • ContentExtenstion getTranslatedFieldValue() gets that "nothing" and tries to get the value property of it, this is where the error occurs

      Attachments

        Activity

          People

            Unassigned Unassigned
            27a86f72-3731-445b-a7d6-4e400f95824e@accounts.ibexa.co Gábor Balogh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: