<?php
/**
 * FormType Handler Interface
 *
 * A FormType Handler is responsible for creating
 * a Symfony Form Field from an FormFieldEntity
 *
 * @author Elze Kool <info@visualmedia.nl>
 */

namespace VisualM\FormBundle\Form\TypeHandler;

use VisualM\FormBundle\Entity\FormFieldInterface;

/**
 * FormType Handler Interface
 *
 * A FormType Handler is responsible for creating
 * a Symfony Form Field from an FormFieldEntity
 *
 * @author Elze Kool <info@visualmedia.nl>
 */
interface FormTypeHandlerInterface
{
    /**
     * Get classname that extends Symfony\Component\Form\AbstractType
     * that handles this field type
     *
     * @param FormFieldEntity $formField Form Field
     *
     * @return string Classname
     */
    public function getSymfonyType(FormFieldInterface $formField);

    /**
     * Get Options for field (including constraints),
     * which options are available depend on
     * the class returned with getSymfonyType()
     *
     * @param FormFieldEntity $formField Form Field
     *
     * @return array Options
     */
    public function getOptions(FormFieldInterface $formField);

    /**
     * Normalize value
     *
     * @param FormFieldEntity $formField Form Field
     * @param mixed           $value     Form field value
     *
     * @return string Normalized value
     */
    public function normalizeValue(FormFieldInterface $formField, $value);

}

