Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Application\Form;
- use \Application\Form\AbstractForm;
- class Quote extends AbstractForm
- {
- public function __construct($em = null)
- {
- parent::__construct($em);
- $this->add(array(
- 'name' => 'name',
- 'type' => 'text',
- 'options' => array(
- 'label' => 'Nom'
- ),
- 'attributes' => array(
- 'required' => true,
- 'class' => 'input-block-level',
- ),
- ));
- $this->add(array(
- 'name' => 'email',
- 'type' => 'email',
- 'options' => array(
- 'label' => 'Courriel'
- ),
- 'attributes' => array(
- 'required' => true,
- 'class' => 'input-block-level',
- ),
- ));
- $this->add(array(
- 'name' => 'phone_number',
- 'type' => 'text',
- 'options' => array(
- 'label' => 'Téléphone'
- ),
- 'attributes' => array(
- 'class' => 'input-block-level',
- 'required' => true,
- ),
- ));
- $budget = array(
- 500.00 => '500.00 $'
- );
- for ($i = 1; $i <= 10; $i++) {
- $val = number_format($i * 1000, 2, '.', '');
- $budget[$val] = $val . ' $';
- }
- $this->add(array(
- 'name' => 'budget',
- 'type' => 'select',
- 'options' => array(
- 'label' => 'Budget',
- 'value_options' => $budget,
- ),
- 'attributes' => array(
- 'class' => 'input-block-level',
- 'required' => true,
- ),
- ));
- $this->add(array(
- 'name' => 'service',
- 'type' => 'DoctrineModule\Form\Element\ObjectSelect',
- 'options' => array(
- 'label' => 'Service',
- 'object_manager' => $this->getObjectManager(),
- 'target_class' => 'Application\Entity\Service',
- 'property' => 'name',
- 'label_generator' => function($targetEntity) {
- $targetEntity->getName();
- },
- ),
- 'attributes' => array(
- 'required' => true,
- 'class' => 'input-block-level',
- ),
- ));
- $this->add(array(
- 'name' => 'content',
- 'type' => 'textarea',
- 'options' => array(
- 'label' => 'Message'
- ),
- 'attributes' => array(
- 'class' => 'input-block-level',
- 'required' => true,
- 'rows' => 12,
- ),
- ));
- $this->add(array(
- 'name' => 'submit',
- 'type' => 'submit',
- 'attributes' => array(
- 'value' => 'Envoyer',
- 'class' => 'btn btn-primary',
- ),
- ));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement