示例#1
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testVerificaSeConsegueSetarLegendVazio()
 {
     $fieldset = new Fieldset('fieldset');
     $fieldset->setLegend('');
 }
示例#2
0
$validator = new Validator($di);
$di->set('validator', $validator);
$produtoManager = new \vendor\Produto\ProdutoManager($di);
$categoriaManager = new CategoriaManager($di);
$formulario = new Form('form-newsletter', 'form', 'form-signin');
$formulario->setDi($di);
$formulario->setMethod('post')->setAction('');
$inputNome = new Text('nome', null, 'form-control');
$inputNome->setPlaceholder('Nome')->isRequired();
$inputValor = new Text('valor', null, 'form-control produto-valor');
$inputValor->setPlaceholder('Valor')->isRequired();
$textareaDescricao = new \vendor\Form\Input\Textarea('descricao', null, 'form-control');
$textareaDescricao->setPlaceholder('Descrição');
$select = new Select('categoria', null, 'form-control');
$categorias = new CategoriaIterator(new Categoria(), $categoriaManager->buscar());
foreach ($categorias as $categoria) {
    $option = new Option($categoria->getNome());
    $option->setValue($categoria->getId());
    $select->add($option);
}
$botaoSubmit = new Button('botao', null, 'btn btn-lg btn-primary btn-block');
$botaoSubmit->setType('submit')->setLabel('Cadastrar');
$fieldset = new Fieldset('fieldset');
$fieldset->setLegend('Cadastro de produto');
$fieldset->add($inputNome);
$fieldset->add($inputValor);
$fieldset->add($textareaDescricao);
$fieldset->add($select);
$fieldset->add($botaoSubmit);
$formulario->add($fieldset);
require "home.php";