<?php

namespace ModulusAcl\Form;

use ModulusForm\Form\FormDefault,
    Zend\Form\Element\Select;

class Route extends FormDefault
{

    public function addElements()
    {

        $this->add(array(
            'name' => 'id',
            'options' => array(
                'label' => '',
            ),
            'attributes' => array(
                'type' => 'hidden'
            ),
        ));

        $this->add(array(
            'name' => 'route',
            'options' => array(
                'label' => 'Rota: ',
                'value_options' => array(

                ),
            ),
            'type' => 'Zend\Form\Element\Select',

            'attributes' => array(
                'placeholder' => 'Selecione a url',

            ),
        ));

        $this->add(array(
            'name' => 'displayName',
            'options' => array(
                'label' => 'Nome de exibição: ',
            ),
            'type' => 'Zend\Form\Element\Text',
            'attributes' => array(
                'placeholder' => 'Entre com o nome',
            ),
        ));

        $this->add(array(
            'type'    => 'DoctrineModule\Form\Element\ObjectSelect',
            'name'    => 'role',
            'options' => array(
                'label'          => 'Tipo de usuário: ',
                'object_manager' => $this->getEntityManager(),
                'target_class'   => 'ModulusAcl\Entity\AclRole',
                'find_method' => array(
                    'name' => 'findByActives',
                    'params' => array('criteria' => array()),
                ),
                'property'       => 'name',
                'selected' =>1,
                'empty_option'   => '',
            ),
        ));

        $this->add(array(
            'type' => 'ModulusForm\Form\Element\Toggle',
            'name' => 'doLog',
            'options' => array(
                'label' => 'Log ao acessar? ',
            ),
        ));

        $this->add(new \Zend\Form\Element\Csrf('security'));

        $this->add(array(
            'name' => 'submit',
            'attributes' => array(
                'value' => 'Salvar',
                'type'  => 'submit',
                'class' => 'btn btn-primary',
            ),
        ));
    }

}
