/** * Builds the form. * * This method is called for each type in the hierarchy starting form the * top most type. Type extensions can further modify the form. * * @see FormTypeExtensionInterface::buildForm() * * @param FormBuilderInterface $builder The form builder * @param array $options The options */ public function buildForm(FormBuilderInterface $builder, array $options) { if ($this->domainConfiguration->isMultiDomainHost()) { $hosts = $this->domainConfiguration->getHosts(); $domains = array_combine($hosts, $hosts); $domains = array_merge(array('' => 'redirect.all'), $domains); $builder->add('domain', 'choice', array('choices' => $domains, 'required' => true, 'expanded' => false, 'multiple' => false)); } $builder->add('origin', 'text', array('required' => true, 'attr' => array('info_text' => 'redirect.origin_info'))); $builder->add('target', 'text', array('required' => true, 'attr' => array('info_text' => 'redirect.target_info'))); $builder->add('permanent', 'checkbox', array('required' => false)); }
/** * Build filters for admin list */ public function buildFilters() { if ($this->domainConfiguration->isMultiDomainHost()) { $hosts = $this->domainConfiguration->getHosts(); $domains = array_combine($hosts, $hosts); $domains = array_merge(array('' => 'redirect.all'), $domains); $this->addFilter('domain', new ORM\EnumerationFilterType('domain'), 'Domain', $domains); } $this->addFilter('origin', new ORM\StringFilterType('origin'), 'Origin'); $this->addFilter('target', new ORM\StringFilterType('target'), 'Target'); $this->addFilter('permanent', new ORM\BooleanFilterType('permanent'), 'Permanent'); }