<?php
namespace OfficeBrain\Bundle\SettingBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints as Assert;



class SettingpageType extends AbstractType {
	public function __construct($status, $action,$id)
	{
		$this->status = $status;
		$this->action = $action;
		$this->id = $id;
	}
	/**
	 *
	 * @param FormBuilderInterface $builder
	 * @param array $options        	
	 */
	public function buildForm(FormBuilderInterface $builder, array $options) 
	{
		$builder->add ('title' , 'text', array(
				'required'  => false,
				'constraints' => array(
						new NotBlank(array('message'=>'Please enter title')),
				),
		))
		->add ('content' , 'textarea', array(
				'required'  => false,
				'constraints' => array(
						new NotBlank(array('message'=>'Please enter detail')),
				),
		))
		-> add ('status' , 'choice', array(
				'choices' => array('Active'=>'Active','Inactive'=>'Inactive') ,
				'multiple'=>false,
				'required'  => false,
				'placeholder'=>'-- Select status --',
				'data' => $this->status,
				'constraints' => array(
						new NotBlank(array('message'=>'Please select status'))
					)
		));
	}

	/**
	 *
	 * @return string
	 */
	public function getName() {
		return 'setting_page';
	}

	public function setForm($form){
    	$this->form = $form;
    }

}