简体   繁体   中英

Render Multi language Records in Extbase Extension in typo3

I am using TYPO3 7.6 and rendering multi language Records using findAll() and findByUid() methods. I wrote below code in my Repository

/*
* Initialize Default Settings
*/
public function initializeObject() {
    $querySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings');
    $querySettings->setRespectStoragePage(FALSE);
    $querySettings->setRespectSysLanguage(TRUE);
    $this->setDefaultQuerySettings($querySettings);
}

I am having 2 language in my website. and My Records Renders correctly on front-end. My Problem is below.

uid     name    fcounter sys_language_id        l10n_parent
________________________________________________________
1       abc       2       0                      0
________________________________________________________
2       abc-en    0       1                      1

So is their any way to increase both languages fcounter field using findByUid() or any other methods of Repository?

The easiest way is to update your TCA definition for your model. The important value is "l10n_display".

defaultAsReadonly – This renders the field as read only field with the content of the default language record. The field will be rendered even if 'l10n_mode' is set to 'exclude'. While 'exclude' define the field not to be translated this option activate display of the default data.

TYPO3 Documentation

"fcounter" => array(
                    "exclude"      => 1,
                    "l10n_mode"    => "exclude",
                    "l10n_display" => "defaultAsReadonly",
                    .....
            ),

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM