GcDevelopment\Form\Datatype::init PHP Method

init() public method

Init Datatype form
public init ( ) : void
return void
    public function init()
    {
        $this->setAttribute('class', 'relative form-horizontal');
        $this->setAttribute('enctype', 'application/x-www-form-urlencoded');
        $name = new Element\Text('name');
        $name->setLabel('Name')->setLabelAttributes(array('class' => 'required control-label col-lg-2'));
        $name->setAttribute('class', 'form-control')->setAttribute('id', 'name');
        $this->add($name);
        $model = new Element\Select('model');
        $options = array();
        foreach ($this->getServiceLocator()->get('DatatypesList') as $dir) {
            $options[$dir] = $dir;
        }
        $model->setOptions(array('label' => 'Model', 'label_attributes' => array('class' => 'required control-label col-lg-2')));
        $model->setValueOptions($options)->setAttribute('class', 'form-control');
        $this->add($model);
        $inputFilterFactory = new InputFilterFactory();
        $inputFilter = $inputFilterFactory->createInputFilter(array('name' => array('required' => true, 'validators' => array(array('name' => 'not_empty'), array('name' => 'db\\no_record_exists', 'options' => array('table' => 'datatype', 'field' => 'name', 'adapter' => $this->getAdapter())))), 'model' => array('required' => true, 'validators' => array(array('name' => 'not_empty')))));
        $this->setInputFilter($inputFilter);
    }
Datatype