* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * */ namespace Sonata\AdminBundle\Form\Type; use Symfony\Component\Form\Extension\Core\Type\ChoiceType as FormChoiceType; use Symfony\Component\Translation\TranslatorInterface; class EqualType extends FormChoiceType { const TYPE_IS_EQUAL = 1; const TYPE_IS_NOT_EQUAL = 2; protected $translator; public function __construct(TranslatorInterface $translator) { $this->translator = $translator; } public function getDefaultOptions(array $options) { $options = parent::getDefaultOptions($options); $options['choices'] = array( self::TYPE_IS_EQUAL => $this->translator->trans('label_type_equals', array(), 'SonataAdminBundle'), self::TYPE_IS_NOT_EQUAL => $this->translator->trans('label_type_not_equals', array(), 'SonataAdminBundle'), ); return $options; } }