本文整理汇总了PHP中eZContentClass::contentObjectName方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentClass::contentObjectName方法的具体用法?PHP eZContentClass::contentObjectName怎么用?PHP eZContentClass::contentObjectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentClass
的用法示例。
在下文中一共展示了eZContentClass::contentObjectName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addTranslation
/**
* Adds a translation in language $newLanguageCode for object
*
* @param string $newLanguageCode
* @param mixed $translationData array( attribute identifier => attribute value )
* @return void
*/
public function addTranslation($newLanguageCode, $translationData)
{
// Make sure to refresh the objects data.
$this->refresh();
$this->object->cleanupInternalDrafts();
$version = $this->object->createNewVersionIn($newLanguageCode);
$version->setAttribute('status', eZContentObjectVersion::STATUS_INTERNAL_DRAFT);
$version->store();
$newVersion = $this->object->version($version->attribute('version'));
$newVersionAttributes = $newVersion->contentObjectAttributes($newLanguageCode);
$versionDataMap = self::createDataMap($newVersionAttributes);
// Start updating new version
$version->setAttribute('modified', time());
$version->setAttribute('status', eZContentObjectVersion::STATUS_DRAFT);
$db = eZDB::instance();
$db->begin();
$version->store();
// @TODO: Add generic datatype support here
foreach ($translationData as $attr => $value) {
if ($versionDataMap[$attr]->attribute('data_type_string') == "ezxmltext") {
$value = $this->processXmlTextData($value, $versionDataMap[$attr]);
}
$versionDataMap[$attr]->setAttribute('data_text', $value);
$versionDataMap[$attr]->store();
}
$db->commit();
//Update the content object name
$db->begin();
$this->object->setName($this->class->contentObjectName($this->object, $version->attribute('version'), $newLanguageCode), $version->attribute('version'), $newLanguageCode);
$db->commit();
// Finally publish object
self::publishContentObject($this->object, $version);
}