DropdownTranslation::checkBeforeAddorUpdate PHP Method

checkBeforeAddorUpdate() public method

Check if a field's translation can be added or updated
public checkBeforeAddorUpdate ( $input, $add = true ) : true
$input translation's fields
$add boolean true if a transaltion must be added, false if updated (true by default)
return true if translation can be added/update, false otherwise
    function checkBeforeAddorUpdate($input, $add = true)
    {
        global $DB;
        $number = $this->getNumberOfTranslations($input['itemtype'], $input['items_id'], $input['field'], $input['language']);
        if ($add) {
            return $number == 0;
        }
        return $number > 0;
    }