?? GreyFile — Mystic File Browser

Current path: home/webdevt/cryptoimpot.fr/module/Application/src/Form/



?? Go up: /home/webdevt/cryptoimpot.fr/module/Application/src

?? Viewing: ContactForm.php

<?php

namespace Application\Form;

use Laminas\Form\Form;

/**
 * This form is used to collect user feedback data like user E-mail, 
 * message subject and text.
 */
class ContactForm extends Form
{
  // Constructor.   
  public function __construct()
  {
    // Define form name
    parent::__construct('contact-form');

    // Set POST method for this form
    $this->setAttribute('method', 'post');
        	
    // Add form elements
    $this->addElements();    
  }
    
  // This method adds elements to form (input fields and 
  // submit button).
  private function addElements() 
  {
    // Add "email" field
    $this->add([
	        'type'  => 'text',
            'name' => 'email',
            'attributes' => [                
                'id' => 'email'
            ],
            'options' => [
                'label' => 'Votre emaill',
            ],
        ]);
        
    // Add "subject" field
    $this->add([
            'type'  => 'text',
            'name' => 'name',
            'attributes' => [
              'id' => 'subject'  
            ],
            'options' => [
                'label' => 'Nom',
            ],
        ]);
    $this->add([
            'type'  => 'text',
            'name' => 'subject',
            'attributes' => [
              'id' => 'subject'  
            ],
            'options' => [
                'label' => 'Sujet',
            ],
        ]);
        
    // Add "body" field
    $this->add([
            'type'  => 'textarea',
            'name' => 'body',			
            'attributes' => [                
			  'id' => 'body'
            ],
            'options' => [
                'label' => 'Message',
            ],
        ]);
    
    $this->add([
            'type' => 'csrf',
            'name' => 'csrf',
            'options' => [
                'csrf_options' => [
                    'timeout' => 6000
                ]
            ],
        ]);
        
    // Add the submit button
    $this->add([
            'type'  => 'submit',
            'name' => 'submit',
            'attributes' => [                
                'value' => 'Envoyer',
            ],
        ]);
    }        
}


??

??