Exemplo n.º 1
0
 public function __construct(EntityManager $em)
 {
     parent::__construct();
     $this->em = $em;
     $this->add(['name' => 'id', 'attributes' => ['type' => 'hidden']])->add(['name' => 'name', 'options' => ['label' => 'Role Name'], 'attributes' => ['type' => 'text', 'placeholder' => 'Role Name', 'class' => 'form-control', 'id' => 'name', 'autofocus' => 'autofocus']])->add(['type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'name' => 'parent', 'options' => ['label' => 'Parent Role', 'object_manager' => $this->em, 'target_class' => 'ZfMuscle\\Entity\\Role', 'property' => 'roleId', 'empty_option' => '--Select--', 'is_method' => true, 'find_method' => ['name' => 'getRoles']], 'attributes' => ['class' => 'full-width', 'data-placeholder' => 'Select Parent Role', 'data-init-plugin' => 'select2', 'id' => 'parent']]);
     $submitElement = new Element\Button('submit');
     $submitElement->setName('submit')->setLabel('Save Role')->setAttributes(['type' => 'submit', 'class' => 'btn btn-primary btn-cons m-t-10', 'id' => 'addrole']);
     $this->add($submitElement, ['priority' => -100]);
 }
Exemplo n.º 2
0
 public function __construct(EntityManager $em)
 {
     parent::__construct();
     $this->em = $em;
     $hiddenElement = new Element\Hidden('id');
     $hiddenElement->setName('id')->setAttributes(array('type' => 'hidden'));
     $this->add($hiddenElement, array());
     $this->add(array('name' => 'name', 'options' => array('label' => 'Category Name'), 'attributes' => array('type' => 'text', 'placeholder' => 'Category Name', 'class' => 'form-control', 'id' => 'name', 'required' => 'required', 'autofocus' => 'autofocus')))->add(array('type' => 'Zend\\Form\\Element\\Csrf', 'name' => 'csrf'));
     $submitElement = new Element\Button('submit');
     $submitElement->setName('submit')->setLabel('Save Category')->setAttributes(array('type' => 'submit', 'class' => 'btn btn-primary btn-sm', 'id' => 'addCategory'));
     $this->add($submitElement, array('priority' => -100));
 }
Exemplo n.º 3
0
 public function __construct(EntityManager $em)
 {
     parent::__construct();
     $this->em = $em;
     $hiddenElement = new Element\Hidden('id');
     $hiddenElement->setName('id')->setAttributes(array('type' => 'hidden'));
     $this->add($hiddenElement, array());
     $this->add(array('name' => 'name', 'options' => array('label' => 'Product Name'), 'attributes' => array('type' => 'text', 'placeholder' => 'Product Name', 'class' => 'form-control', 'id' => 'name', 'required' => 'required', 'autofocus' => 'autofocus')))->add(array('name' => 'sku', 'options' => array('label' => 'SKU'), 'attributes' => array('type' => 'text', 'placeholder' => 'SKU', 'class' => 'form-control', 'id' => 'sku', 'required' => 'required')))->add(array('name' => 'price', 'options' => array('label' => 'Product Price', 'help' => 'Price must be of type float i.e 50.00'), 'attributes' => array('type' => 'text', 'placeholder' => 'Product Price', 'class' => 'form-control', 'id' => 'price', 'required' => 'required')))->add(array('type' => 'Zend\\Form\\Element\\Number', 'name' => 'qty', 'options' => array('label' => 'Qty in Stock'), 'attributes' => array('min' => '0', 'step' => '1', 'placeholder' => 'Qty in Stock', 'class' => 'form-control', 'id' => 'qty', 'required' => 'required')))->add(array('type' => 'Zend\\Form\\Element\\Csrf', 'name' => 'csrf'));
     $textAreaElement = new Element\Textarea('description');
     $textAreaElement->setName('description')->setLabel('Product Description')->setAttributes(array('type' => 'textarea', 'placeholder' => 'Product Description', 'class' => 'form-control', 'rows' => '3', 'id' => 'description', 'required' => 'required'));
     $this->add($textAreaElement, array());
     $submitElement = new Element\Button('submit');
     $submitElement->setName('submit')->setLabel('Save Product')->setAttributes(array('type' => 'submit', 'class' => 'btn btn-primary btn-sm', 'id' => 'addProduct'));
     $this->add($submitElement, array('priority' => -100));
 }