public function getFilterWidgetAction(Request $request)
    {
        $translator = $this->get('translator');
        $fieldSet = $request->get('fieldset');
        $field = $request->get('field');

        $config = $this->admin->getConfigurationPool()->getContainer()->getParameter('librinfo_varieties');
        $fieldConfig = $config['variety_descriptions'][$fieldSet][$field];
        $choiceType = CustomChoiceType::class;
        $options = $fieldConfig['options'];
        $type = $fieldConfig['type'] != 'textarea' ? $fieldConfig['type'] : 'text';

        if ($type == 'blast_custom_checkbox') {
            $type = 'choice';
            $options = array_merge($options, array(
                'choices' => array('1' => $translator->trans('yes'), '0' => $translator->trans('no')),
            ));
        }

        if ($type == $choiceType) {
            $options['is_filter'] = true;

            if (isset($options['expanded'])) {
                unset($options['expanded']);
            }

            if (isset($options['multiple'])) {
                unset($options['multiple']);
            }
        }

        if ($type == 'blast_tinymce') {
            $type = 'text';
        }

        if (isset($options['choices']) && empty($options['choices'])) {
            unset($options['choices']);
        }

        if (isset($options['choices_class']) && $type != $choiceType) {
            unset($options['choices_class']);
        }

        if (isset($options['blast_choices']) && $type != $choiceType) {
            unset($options['blast_choices']);
        }

        if (isset($options['help'])) {
            unset($options['help']);
        }

        $view = $this->createFormBuilder()
                ->add('value', $type, $options)
                ->getForm()
                ->createView()
        ;

        return $this->render(
            'LibrinfoVarietiesBundle:Form:filter_widget.html.twig',
            array(
                'form' => $view,
            ),
            null
        );
    }
public function getFilterWidgetAction(Request $request)
    {
        $translator = $this->get('translator');
        $fieldSet = $request->get('fieldset');
        $field = $request->get('field');

        $config = $this->admin->getConfigurationPool()->getContainer()->getParameter('librinfo_varieties');
        $fieldConfig = $config['variety_descriptions'][$fieldSet][$field];
        $choiceType = CustomChoiceType::class;
        $options = $fieldConfig['options'];
        $type = $fieldConfig['type'] != 'textarea' ? $fieldConfig['type'] : 'text';

        if ($type == 'blast_custom_checkbox') {
            $type = 'choice';
            $options = array_merge($options, array(
                'choices' => array('1' => $translator->trans('yes'), '0' => $translator->trans('no')),
            ));
        }

        if ($type == $choiceType) {
            $options['is_filter'] = true;

            if (isset($options['expanded'])) {
                unset($options['expanded']);
            }

            if (isset($options['multiple'])) {
                unset($options['multiple']);
            }
        }

        if ($type == 'blast_tinymce') {
            $type = 'text';
        }

        if (isset($options['choices']) && empty($options['choices'])) {
            unset($options['choices']);
        }

        if (isset($options['choices_class']) && $type != $choiceType) {
            unset($options['choices_class']);
        }

        if (isset($options['blast_choices']) && $type != $choiceType) {
            unset($options['blast_choices']);
        }

        if (isset($options['help'])) {
            unset($options['help']);
        }

        $view = $this->createFormBuilder()
                ->add('value', $type, $options)
                ->getForm()
                ->createView()
        ;

        return $this->render(
            'LibrinfoVarietiesBundle:Form:filter_widget.html.twig',
            array(
                'form' => $view,
            ),
            null
        );
    }
public function getFilterWidgetAction ( Request $ request ) { $ translator = $ this -> get ( 'translator' ) ; $ fieldSet = $ request -> get ( 'fieldset' ) ; $ field = $ request -> get ( 'field' ) ; $ config = $ this -> admin -> getConfigurationPool ( ) -> getContainer ( ) -> getParameter ( 'librinfo_varieties' ) ; $ fieldConfig = $ config [ 'variety_descriptions' ] [ $ fieldSet ] [ $ field ] ; $ choiceType = CustomChoiceType :: class ; $ options = $ fieldConfig [ 'options' ] ; $ type = $ fieldConfig [ 'type' ] != 'textarea' ? $ fieldConfig [ 'type' ] : 'text' ; if ( $ type == 'blast_custom_checkbox' ) { $ type = 'choice' ; $ options = array_merge ( $ options , array ( 'choices' => array ( '1' => $ translator -> trans ( 'yes' ) , '0' => $ translator -> trans ( 'no' ) ) , ) ) ; } if ( $ type == $ choiceType ) { $ options [ 'is_filter' ] = true ; if ( isset ( $ options [ 'expanded' ] ) ) { unset ( $ options [ 'expanded' ] ) ; } if ( isset ( $ options [ 'multiple' ] ) ) { unset ( $ options [ 'multiple' ] ) ; } } if ( $ type == 'blast_tinymce' ) { $ type = 'text' ; } if ( isset ( $ options [ 'choices' ] ) && empty ( $ options [ 'choices' ] ) ) { unset ( $ options [ 'choices' ] ) ; } if ( isset ( $ options [ 'choices_class' ] ) && $ type != $ choiceType ) { unset ( $ options [ 'choices_class' ] ) ; } if ( isset ( $ options [ 'blast_choices' ] ) && $ type != $ choiceType ) { unset ( $ options [ 'blast_choices' ] ) ; } if ( isset ( $ options [ 'help' ] ) ) { unset ( $ options [ 'help' ] ) ; } $ view = $ this -> createFormBuilder ( ) -> add ( 'value' , $ type , $ options ) -> getForm ( ) -> createView ( ) ; return $ this -> render ( 'LibrinfoVarietiesBundle:Form:filter_widget.html.twig' , array ( 'form' => $ view , ) , null ) ; }
Get field widget for filter form.

@param string $fieldName the name of the field to get the form widget for

@return JsonResponse
Get field widget for filter form .