Swat/SwatFileEntry.php
protected function getValidationMessage($id)
    {
        switch ($id) {
            case 'mime-type':
                $displayable_types = $this->getDisplayableTypes();

                if ($this->show_field_title_in_messages) {
                    $text = sprintf(
                        Swat::ngettext(
                            'The %%s field must be of the following type: %s.',
                            'The %%s field must be of the following type(s): %s.',
                            count($displayable_types)
                        ),
                        implode(', ', $displayable_types)
                    );
                } else {
                    $text = sprintf(
                        Swat::ngettext(
                            'This field must be of the following type: %s.',
                            'This field must be of the following type(s): %s.',
                            count($displayable_types)
                        ),
                        implode(', ', $displayable_types)
                    );
                }

                $message = new SwatMessage($text, 'error');
                break;

            case 'too-large':
                if ($this->show_field_title_in_messages) {
                    $text = Swat::_(
                        'The %s field exceeds the maximum allowable file size.'
                    );
                } else {
                    $text = Swat::_(
                        'This field exceeds the maximum allowable file size.'
                    );
                }

                $message = new SwatMessage($text, 'error');
                break;

            case 'upload-error':
                if ($this->show_field_title_in_messages) {
                    $text = Swat::_(
                        'The %s field encounted an error when trying to upload ' .
                            'the file. Please try again.'
                    );
                } else {
                    $text = Swat::_(
                        'This field encounted an error when trying to upload the ' .
                            'file. Please try again.'
                    );
                }

                $message = new SwatMessage($text, 'error');
                break;

            default:
                $message = parent::getValidationMessage($id);
                break;
        }

        return $message;
    }
protected function getValidationMessage($id)
    {
        switch ($id) {
            case 'mime-type':
                $displayable_types = $this->getDisplayableTypes();

                if ($this->show_field_title_in_messages) {
                    $text = sprintf(
                        Swat::ngettext(
                            'The %%s field must be of the following type: %s.',
                            'The %%s field must be of the following type(s): %s.',
                            count($displayable_types)
                        ),
                        implode(', ', $displayable_types)
                    );
                } else {
                    $text = sprintf(
                        Swat::ngettext(
                            'This field must be of the following type: %s.',
                            'This field must be of the following type(s): %s.',
                            count($displayable_types)
                        ),
                        implode(', ', $displayable_types)
                    );
                }

                $message = new SwatMessage($text, 'error');
                break;

            case 'too-large':
                if ($this->show_field_title_in_messages) {
                    $text = Swat::_(
                        'The %s field exceeds the maximum allowable file size.'
                    );
                } else {
                    $text = Swat::_(
                        'This field exceeds the maximum allowable file size.'
                    );
                }

                $message = new SwatMessage($text, 'error');
                break;

            case 'upload-error':
                if ($this->show_field_title_in_messages) {
                    $text = Swat::_(
                        'The %s field encounted an error when trying to upload ' .
                            'the file. Please try again.'
                    );
                } else {
                    $text = Swat::_(
                        'This field encounted an error when trying to upload the ' .
                            'file. Please try again.'
                    );
                }

                $message = new SwatMessage($text, 'error');
                break;

            default:
                $message = parent::getValidationMessage($id);
                break;
        }

        return $message;
    }
protected function getValidationMessage ( $ id ) { switch ( $ id ) { case 'mime-type' : $ displayable_types = $ this -> getDisplayableTypes ( ) ; if ( $ this -> show_field_title_in_messages ) { $ text = sprintf ( Swat :: ngettext ( 'The %%s field must be of the following type: %s.' , 'The %%s field must be of the following type(s): %s.' , count ( $ displayable_types ) ) , implode ( ', ' , $ displayable_types ) ) ; } else { $ text = sprintf ( Swat :: ngettext ( 'This field must be of the following type: %s.' , 'This field must be of the following type(s): %s.' , count ( $ displayable_types ) ) , implode ( ', ' , $ displayable_types ) ) ; } $ message = new SwatMessage ( $ text , 'error' ) ; break ; case 'too-large' : if ( $ this -> show_field_title_in_messages ) { $ text = Swat :: _ ( 'The %s field exceeds the maximum allowable file size.' ) ; } else { $ text = Swat :: _ ( 'This field exceeds the maximum allowable file size.' ) ; } $ message = new SwatMessage ( $ text , 'error' ) ; break ; case 'upload-error' : if ( $ this -> show_field_title_in_messages ) { $ text = Swat :: _ ( 'The %s field encounted an error when trying to upload ' . 'the file. Please try again.' ) ; } else { $ text = Swat :: _ ( 'This field encounted an error when trying to upload the ' . 'file. Please try again.' ) ; } $ message = new SwatMessage ( $ text , 'error' ) ; break ; default : $ message = parent :: getValidationMessage ( $ id ) ; break ; } return $ message ; }
Gets a validation message for this file entry

Can be used by sub-classes to change the validation messages.

@param string $id the string identifier of the validation message.

@return SwatMessage the validation message.
Gets a validation message for this file entry