Example #1
0
 /**
  * @param string $name
  * @param string $label
  * @param string $namespace
  * @return Upload
  * @throws FormException
  */
 public function addImageUpload($name, $label, $namespace = NULL)
 {
     if (!class_exists(Upload::class)) {
         throw new FormException('Install the extension via webchemistry/images.');
     }
     $control = new Upload($label);
     $control->setNamespace($namespace);
     return $this[$name] = $control;
 }
Example #2
0
 public function testRegistration()
 {
     \WebChemistry\Images\Controls\Upload::register();
     $form = new \Nette\Forms\Form();
     $upload = $form->addImageUpload('image');
     $this->assertInstanceOf('WebChemistry\\Images\\Controls\\Upload', $upload);
 }