7

Update or create multiple languages at once using eZ Platform PHP API

 3 years ago
source link: https://www.symfony.fi/ez-platform-tip/update-or-create-multiple-languages-at-once-using-ez-platform-php-api
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Update or create multiple languages at once using eZ Platform PHP API

It is possible to create or update content in multiple languages at once. There is one restriction: only one language can be set a version's language. This language is the one that will get a flag in the back office. However, you can set values in other languages for your attributes, using the setField method's third argument.

update multiple languages
// set one language for new version
$contentUpdateStruct->initialLanguageCode = 'fre-FR';
 
$contentUpdateStruct->setField( 'title', $newgermantitle, 'ger-DE' );
$contentUpdateStruct->setField( 'body', $newgermanbody, 'ger-DE' );
 
$contentUpdateStruct->setField( 'title', $newfrenchtitle );
$contentUpdateStruct->setField( 'body', $newfrenchbody );

This also works when creating new content with the contentUpdateStruct created with newContentCreateStruct.

Source: https://doc.ez.no/display/EZP/3.+Managing+Content


Written by Jani Tarvainen on Thursday May 24, 2018
Permalink -

« Migrating eZ Platform Landing Pages and Form Builder Forms - Convert RichText to HTML in PHP API »


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK