5

In TYPO3 6.2 in my model I have a common field for files called documents, it's ObjectStorage of \TYPO3\CMS\Extbase\Domain\Model\FileReference nothing unusual :)

The problem is on localized pages, just when I create a localized version of my obj all its fields are localized properly but not documents - it always uses a file ref(s) from default language :/ I read about unresolved bugs for this, but there's no working workaround pointed... Can any suggest me what to do?

If nothing will help I'll just write my own FileRef model, but would be great to avoid this as has several places to change.

My field in model (getter and setter are standard)

/**
 * Documents
 *
 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
 * @cascade remove
 */
protected $documents = NULL;

and in TCA:

'documents' => array(
    'exclude' => 1,
    'label' => 'Documents',
    'config' =>
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
            'documents',
            array('maxitems' => 999)
        ),
),
biesior
  • 55,576
  • 10
  • 125
  • 182
  • P.S. Need to mention, that for some reasons, I cannot add patches to TYPO3's sources. – biesior Oct 09 '15 at 17:52
  • There is a long-long story, I'm watching since year [#57272](https://forge.typo3.org/issues/57272). There are already few patches provided, so you can try some of them - maybe it will solve issue in your case, while there is still no universal silution. – Viktor Livakivskyi Oct 10 '15 at 09:29
  • Sad news looks like I'm convicted to my own FileRef :/ – biesior Oct 10 '15 at 10:53

1 Answers1

2

There are two bugs in the front-end of TYPO3 if it's about overlaying translations for pages. The reason is, that this table uses a dedicated table pages_language_overlay to keep these translations.

When translating a page, the child records (file references) are not copied to the new localized record. The behavior should be the same if compared to translation a content element. Fixing this behavior will rather only be integrated in TYPO3 CMS 7 and CMS 8, see issue #78743 for progress in the next days/weeks.

If you share file references between the original language record and the translated record, meaning that the translated record does not define individual file references, then you can work around these empty file references when showing the translated page in the front-end by modifying TCA.

// put that to some TCA Overrides file, e.g.
// typo3conf/ext/my_ext/Configuration/TCA/Overrides/pages_language_overlay.php
$GLOBALS['TCA']['pages_language_overlay']['columns']['documents']['l10n_mode'] = 'exclude';

Using the exclude mode instructs TYPO3 to skip overlaying for the field documents in the front-end rendering process. The overlay process happens in PageRepository which is invoked by Extbase as well when the Page model gets reconstituted from storage.

Oliver Hader
  • 4,093
  • 1
  • 25
  • 47