本文整理汇总了PHP中eZContentOperationCollection::updateInitialLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentOperationCollection::updateInitialLanguage方法的具体用法?PHP eZContentOperationCollection::updateInitialLanguage怎么用?PHP eZContentOperationCollection::updateInitialLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentOperationCollection
的用法示例。
在下文中一共展示了eZContentOperationCollection::updateInitialLanguage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runOperation
function runOperation(&$node)
{
$object = $node->attribute('object');
$object_id = $object->attribute('id');
$objectLocales = $object->attribute('available_languages');
// If the alternative locale does not exist for object, create it
if (!in_array($this->altLocale, $objectLocales)) {
// The only translation is in locate to be removed - create a version in another locale first.
echo "Copying the single translation in " . $this->remLocale . " to " . $this->altLocale . " so former could be removed.\n";
$newVersion = $object->createNewVersionIn($this->altLocale, $this->remLocale, false, true, eZContentObjectVersion::STATUS_DRAFT);
$publishResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $object_id, 'version' => $newVersion->attribute('version')));
eZContentObject::clearCache();
$object = eZContentObject::fetch($object_id);
}
// Change objects main language to alternative language, if its current main language is to be removed.
if ($object->attribute('initial_language_code') == $this->remLocale) {
eZContentObject::clearCache();
$object = eZContentObject::fetch($object_id);
echo "Switching initial language to {$this->altLocale} so that " . $this->remLocale . " could be removed.\n";
$updateResult = eZContentOperationCollection::updateInitialLanguage($object_id, $this->altLangID);
$object->store();
eZContentObject::clearCache();
$object = eZContentObject::fetch($object_id);
}
// Now it should be safe to remove translation.
return $object->removeTranslation($this->remLangID);
}
示例2: array
}
$objectID = $module->actionParameter('ObjectID');
$object = eZContentObject::fetch($objectID);
if (!$object) {
return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if ($module->isCurrentAction('UpdateInitialLanguage')) {
if ($module->hasActionParameter('InitialLanguageID')) {
$newInitialLanguageID = $module->actionParameter('InitialLanguageID');
if (!$object->canEdit()) {
return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel', array());
}
if (eZOperationHandler::operationIsAvailable('content_updateinitiallanguage')) {
$operationResult = eZOperationHandler::execute('content', 'updateinitiallanguage', array('object_id' => $objectID, 'new_initial_language_id' => $newInitialLanguageID, 'node_id' => $nodeID));
} else {
eZContentOperationCollection::updateInitialLanguage($objectID, $newInitialLanguageID);
}
}
return $module->redirectToView('view', array($viewMode, $nodeID, $languageCode));
} else {
if ($module->isCurrentAction('UpdateAlwaysAvailable')) {
if (!$object->canEdit()) {
return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel', array());
}
$newAlwaysAvailable = $module->hasActionParameter('AlwaysAvailable');
if (eZOperationHandler::operationIsAvailable('content_updatealwaysavailable')) {
$operationResult = eZOperationHandler::execute('content', 'updatealwaysavailable', array('object_id' => $objectID, 'new_always_available' => $newAlwaysAvailable, 'node_id' => $nodeID));
} else {
eZContentOperationCollection::updateAlwaysAvailable($objectID, $newAlwaysAvailable);
}
return $module->redirectToView('view', array($viewMode, $nodeID, $languageCode));