Path

ez projects / powercontent / forum / general / adding support for creating...


adding support for creating content in a specific language

You need to be logged in to post messages in the forums. New users may register here.

Gaetano Giunta

Member since:
30 November 1999

Posts: 269

Monday 10 August 2009 4:38:48 pm

It seems to work in plain obj creation, nut not with powercontent.

Here's da patch:



--- D:/htdocs/ezp/client1/trunk/extension/powercontent/modules/powercontent/action.php  Mon Aug 10 16:34:04 2009


+++ D:/htdocs/ezp/client1/trunk/extension/powercontent/modules/powercontent/action.php  Mon Aug 10 16:33:56 2009


@@ -52,17 +52,35 @@


                $userID = $user->attribute( 'contentobject_id' );


                $sectionID = $parentContentObject->attribute( 'section_id' );


 

+


+               //// patch by G. Giunta - add support for langs


+               $EditLanguage = false;


+               if ( $http->hasPostVariable( 'ContentLanguageCode' ) )


+               {


+                   $languageCode = $http->postVariable( 'ContentLanguageCode' );


+                   $languageID = eZContentLanguage::idByLocale( $languageCode );


+                   if ( $languageID === false )


+                   {


+                       eZDebug::writeError( "The language code [$languageCode] specified in ContentLanguageCode does not exist in the system.", __METHOD__ );


+                       return $module->handleError( eZError::KERNEL_NOT_AVAILABLE, 'kernel' );


+                   }


+                   else


+                   {


+                       $EditLanguage = $languageCode;


+                   }


+               }


+


                $db = eZDB::instance();


                $db->begin();


 

-               $object = $class->instantiate( $userID, $sectionID );


+               $object = $class->instantiate( $userID, $sectionID, false, $EditLanguage );


+               //// /patch by G. Giunta


+


                $ObjectID = $object->attribute( 'id' );


 

                $version = $object->currentVersion();


                $EditVersion = $version->attribute( 'version' );


 

-               $EditLanguage = false;


-


                $time = time();


 

                $version->setAttribute( 'created', $time );


@@ -248,4 +266,4 @@


 }


 

 return $module->handleError( eZError::KERNEL_ACCESS_DENIED, 'kernel' );


-?>


+?>


\ No newline at end of file


 

Principal Consultant International Business
Member of the Community Project Board

Up

You need to be logged in to post messages in the forums. New users may register here.