eZContentOperationCollection::changeTranslationAvailableStatus PHP Method

changeTranslationAvailableStatus() public static method

Changes the status of a translation
public static changeTranslationAvailableStatus ( integer $objectID, integer $status = false ) : array
$objectID integer
$status integer
return array An array with operation status, always true
    public static function changeTranslationAvailableStatus($objectID, $status = false)
    {
        $object = eZContentObject::fetch($objectID);
        if (!$object->canEdit()) {
            return array('status' => false);
        }
        if ($object->isAlwaysAvailable() & $status == false) {
            $object->setAlwaysAvailableLanguageID(false);
            eZContentCacheManager::clearContentCacheIfNeeded($objectID);
        } else {
            if (!$object->isAlwaysAvailable() & $status == true) {
                $object->setAlwaysAvailableLanguageID($object->attribute('initial_language_id'));
                eZContentCacheManager::clearContentCacheIfNeeded($objectID);
            }
        }
        return array('status' => true);
    }