src/Factory/Form/AttachmentsFormFactory.php
protected function configureForm($form, AbstractOptions $options)
    {
        if (!$options instanceof ModuleOptions) {
            throw new \InvalidArgumentException(sprintf('$options must be instance of %s', ModuleOptions::class));
        }
        
        $size = $options->getAttachmentsMaxSize();
        $type = $options->getAttachmentsMimeType();
        $count = $options->getAttachmentsCount();

        $form->setIsDisableCapable(false)
             ->setIsDisableElementsCapable(false)
             ->setIsDescriptionsEnabled(true)
             ->setDescription(
                /*@translate*/ 'Attach images or PDF Documents to your CV. Drag&drop them, or click into the attachement area. You can upload up to %sMB',
                 [round($size/(1024*1024))>0? round($size/(1024*1024)):round($size/(1024*1024), 1)]
             )
             ->setParam('return', 'file-uri')
             ->setLabel(/*@translate*/ 'Attachments');

        /* @var $file \Core\Form\Element\FileUpload */
        $file = $form->get($this->fileName);

        $file->setMaxSize($size);
        if ($type) {
            $file->setAllowedTypes($type);
        }
        $file->setMaxFileCount($count);

        // pass form to element. Needed for file count validation
        // I did not find another (better) way.
        $file->setForm($form);
    }
protected function configureForm($form, AbstractOptions $options)
    {
        if (!$options instanceof ModuleOptions) {
            throw new \InvalidArgumentException(sprintf('$options must be instance of %s', ModuleOptions::class));
        }
        
        $size = $options->getAttachmentsMaxSize();
        $type = $options->getAttachmentsMimeType();
        $count = $options->getAttachmentsCount();

        $form->setIsDisableCapable(false)
             ->setIsDisableElementsCapable(false)
             ->setIsDescriptionsEnabled(true)
             ->setDescription(
                /*@translate*/ 'Attach images or PDF Documents to your CV. Drag&drop them, or click into the attachement area. You can upload up to %sMB',
                 [round($size/(1024*1024))>0? round($size/(1024*1024)):round($size/(1024*1024), 1)]
             )
             ->setParam('return', 'file-uri')
             ->setLabel(/*@translate*/ 'Attachments');

        /* @var $file \Core\Form\Element\FileUpload */
        $file = $form->get($this->fileName);

        $file->setMaxSize($size);
        if ($type) {
            $file->setAllowedTypes($type);
        }
        $file->setMaxFileCount($count);

        // pass form to element. Needed for file count validation
        // I did not find another (better) way.
        $file->setForm($form);
    }
protected function configureForm ( $ form , AbstractOptions $ options ) { if ( ! $ options instanceof ModuleOptions ) { throw new \ InvalidArgumentException ( sprintf ( '$options must be instance of %s' , ModuleOptions :: class ) ) ; } $ size = $ options -> getAttachmentsMaxSize ( ) ; $ type = $ options -> getAttachmentsMimeType ( ) ; $ count = $ options -> getAttachmentsCount ( ) ; $ form -> setIsDisableCapable ( false ) -> setIsDisableElementsCapable ( false ) -> setIsDescriptionsEnabled ( true ) -> setDescription ( /*@translate*/ 'Attach images or PDF Documents to your CV. Drag&drop them, or click into the attachement area. You can upload up to %sMB' , [ round ( $ size / ( 1024 * 1024 ) ) > 0 ? round ( $ size / ( 1024 * 1024 ) ) : round ( $ size / ( 1024 * 1024 ) , 1 ) ] ) -> setParam ( 'return' , 'file-uri' ) -> setLabel ( /*@translate*/ 'Attachments' ) ; /* @var $file \Core\Form\Element\FileUpload */ $ file = $ form -> get ( $ this -> fileName ) ; $ file -> setMaxSize ( $ size ) ; if ( $ type ) { $ file -> setAllowedTypes ( $ type ) ; } $ file -> setMaxFileCount ( $ count ) ; // pass form to element. Needed for file count validation // I did not find another (better) way. $ file -> setForm ( $ form ) ; }
configure the formular for uploading attachments

@param Form $form
@param AbstractOptions $options
configure the formular for uploading attachments