Beispiel #1
0
 /**
  * Test render with a value
  *
  * @return void
  */
 public function testRenderAttributes()
 {
     $input = new FileWidget($this->templates);
     $data = ['name' => 'image', 'required' => true, 'val' => 'nope'];
     $result = $input->render($data, $this->context);
     $expected = ['input' => ['type' => 'file', 'required' => 'required', 'name' => 'image']];
     $this->assertHtml($expected, $result);
 }
Beispiel #2
0
 /**
  * Ensure templateVars option is hooked up.
  *
  * @return void
  */
 public function testRenderTemplateVars()
 {
     $this->templates->add(['file' => '<input custom="{{custom}}" type="file" name="{{name}}"{{attrs}}>']);
     $input = new FileWidget($this->templates);
     $data = ['templateVars' => ['custom' => 'value'], 'name' => 'files'];
     $result = $input->render($data, $this->context);
     $expected = ['input' => ['type' => 'file', 'name' => 'files', 'custom' => 'value']];
     $this->assertHtml($expected, $result);
 }
 public function render(array $data, ContextInterface $context)
 {
     $this->_View->Html->css('Garderobe/BootstrapKit.fileuploadplus/style.css', ['block' => true]);
     $this->_View->Html->css('Garderobe/BootstrapKit.fileuploadplus/jquery.fileupload.css', ['block' => true]);
     $this->_View->Html->script('Garderobe/BootstrapKit.fileuploadplus/vendor/jquery.ui.widget.js', ['block' => true]);
     $this->_View->Html->script('Garderobe/BootstrapKit.fileuploadplus/jquery.iframe-transport.js', ['block' => true]);
     $this->_View->Html->script('Garderobe/BootstrapKit.fileuploadplus/jquery.fileupload.js', ['block' => true]);
     $this->_View->Html->script('Garderobe/BootstrapKit.fileuploadplus/jquery.fileupload-process.js', ['block' => true]);
     $this->_View->Html->script('Garderobe/BootstrapKit.fileuploadplus/jquery.fileupload-validate.js', ['block' => true]);
     //$this->_View->Html->scriptBlock($js, ['block' => true]);
     if (!isset($data['class'])) {
         $data['class'] = 'file-upload';
     } else {
         $data['class'] .= ' file-upload';
     }
     return parent::render($data, $context);
 }