sathyashrayan

AddAttribute.php

Aug 5th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.73 KB | None | 0 0
  1. <?php
  2. namespace Attributes\Form;
  3.  
  4. use Zend\Form\Form;
  5.  
  6. use Zend\Hydrator\Reflection as ReflectionHydrator;
  7.  
  8. use Attributes\Model\EavAttribute;
  9.  
  10. class AddAttribute extends Form
  11. {
  12.  
  13.     public function __construct($name = null, $options = array()){
  14.        
  15.         parent::__construct($name, $options);
  16.         $this->setHydrator(new ReflectionHydrator());
  17.         $this->setObject(new EavAttribute());
  18.     }
  19.    
  20.     public function init(){
  21.                                        
  22.         $this->add([
  23.                 'name'=>'EavAttribute',
  24.                 'type'=>AttributeFieldset::class, //service name from module.config.php
  25.         ]);
  26.        
  27.         $this->add([
  28.                 'name' => 'submit',
  29.                 'attributes' => [
  30.                         'type' => 'submit',
  31.                         'value' => 'Save',
  32.                         'class' => 'btn btn-primary',
  33.                 ],
  34.         ]);
  35.        
  36.     }
  37.    
  38. }
Add Comment
Please, Sign In to add comment