Example #1
0
 public function testSetGetIsDisableCapable()
 {
     $input = true;
     $this->target->setIsDisableCapable($input);
     $this->assertAttributeSame(['is_disable_capable' => $input], 'options', $this->target);
     $this->assertEquals($this->target->isDisableCapable(), $input);
 }
Example #2
0
 /**
  * configure the formular for uploading attachments
  *
  * @param Form $form
  * @param AbstractOptions $options
  */
 protected function configureForm($form, AbstractOptions $options)
 {
     $form->setIsDisableCapable(false)->setIsDisableElementsCapable(false)->setIsDescriptionsEnabled(true)->setDescription('Attach images or PDF Documents to your application. Drag&drop them, or click into the attachement area. You can upload up to 5MB')->setParam('return', 'file-uri')->setLabel('Attachments');
     /** @var $file FileUpload*/
     $file = $form->get($this->fileName);
     /** @var ModuleOptions $options */
     $size = $options->getAttachmentsMaxSize();
     $type = $options->getAttachmentsMimeType();
     $count = $options->getAttachmentsCount();
     $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
  */
 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('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('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);
 }