public function onBeforeWrite()
    {
        if (!isset(self::$localizedFields[$this->ownerBaseClass])) {
            return;
        }

        $fields = self::$localizedFields[$this->ownerBaseClass];
        foreach ($fields as $field => $localized) {
            foreach (self::get_target_locales() as $locale) {
                $fieldName = self::localized_field($field, $locale);
                if ($this->owner->isChanged($fieldName, 2) && !$this->canTranslate(null, $locale)) {
                    throw new PermissionFailureException(
                        "You're not allowed to edit the locale '$locale' for this object");
                }
            }
        }
    }
public function onBeforeWrite()
    {
        if (!isset(self::$localizedFields[$this->ownerBaseClass])) {
            return;
        }

        $fields = self::$localizedFields[$this->ownerBaseClass];
        foreach ($fields as $field => $localized) {
            foreach (self::get_target_locales() as $locale) {
                $fieldName = self::localized_field($field, $locale);
                if ($this->owner->isChanged($fieldName, 2) && !$this->canTranslate(null, $locale)) {
                    throw new PermissionFailureException(
                        "You're not allowed to edit the locale '$locale' for this object");
                }
            }
        }
    }
public function onBeforeWrite ( ) { if ( ! isset ( self :: $ localizedFields [ $ this -> ownerBaseClass ] ) ) { return ; } $ fields = self :: $ localizedFields [ $ this -> ownerBaseClass ] ; foreach ( $ fields as $ field => $ localized ) { foreach ( self :: get_target_locales ( ) as $ locale ) { $ fieldName = self :: localized_field ( $ field , $ locale ) ; if ( $ this -> owner -> isChanged ( $ fieldName , 2 ) && ! $ this -> canTranslate ( null , $ locale ) ) { throw new PermissionFailureException ( "You're not allowed to edit the locale '$locale' for this object" ) ; } } } }
On before write hook.
Check if any translatable field has changed and if permissions are sufficient
@see DataExtension::onBeforeWrite()
On before write hook . Check if any translatable field has changed and if permissions are sufficient