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)
),
),
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With