protected function getAjaxUrlAndRouteName(FormInterface $form, array $options)
    {
        $ajaxUrl = $this->requestStack->getMasterRequest()->getRequestUri();
        $routeName = null;

        if ($options['select2']['ajax']) {
            if (null !== $options['select2']['ajax_url']) {
                $ajaxUrl = $options['select2']['ajax_url'];
                $routeName = 'custom_url';
            } else {
                $routeName = $form->getConfig()->getAttribute('select2_ajax_route', $options['select2']['ajax_route']);

                if (null !== $routeName) {
                    $routeParams = $options['select2']['ajax_parameters'];
                    $routeReferenceType = $options['select2']['ajax_reference_type'];
                    $ajaxUrl = $this->router->generate($routeName, $routeParams, $routeReferenceType);
                }
            }
        }

        return [$ajaxUrl, $routeName];
    }
protected function getAjaxUrlAndRouteName(FormInterface $form, array $options)
    {
        $ajaxUrl = $this->requestStack->getMasterRequest()->getRequestUri();
        $routeName = null;

        if ($options['select2']['ajax']) {
            if (null !== $options['select2']['ajax_url']) {
                $ajaxUrl = $options['select2']['ajax_url'];
                $routeName = 'custom_url';
            } else {
                $routeName = $form->getConfig()->getAttribute('select2_ajax_route', $options['select2']['ajax_route']);

                if (null !== $routeName) {
                    $routeParams = $options['select2']['ajax_parameters'];
                    $routeReferenceType = $options['select2']['ajax_reference_type'];
                    $ajaxUrl = $this->router->generate($routeName, $routeParams, $routeReferenceType);
                }
            }
        }

        return [$ajaxUrl, $routeName];
    }
protected function getAjaxUrlAndRouteName ( FormInterface $ form , array $ options ) { $ ajaxUrl = $ this -> requestStack -> getMasterRequest ( ) -> getRequestUri ( ) ; $ routeName = null ; if ( $ options [ 'select2' ] [ 'ajax' ] ) { if ( null !== $ options [ 'select2' ] [ 'ajax_url' ] ) { $ ajaxUrl = $ options [ 'select2' ] [ 'ajax_url' ] ; $ routeName = 'custom_url' ; } else { $ routeName = $ form -> getConfig ( ) -> getAttribute ( 'select2_ajax_route' , $ options [ 'select2' ] [ 'ajax_route' ] ) ; if ( null !== $ routeName ) { $ routeParams = $ options [ 'select2' ] [ 'ajax_parameters' ] ; $ routeReferenceType = $ options [ 'select2' ] [ 'ajax_reference_type' ] ; $ ajaxUrl = $ this -> router -> generate ( $ routeName , $ routeParams , $ routeReferenceType ) ; } } } return [ $ ajaxUrl , $ routeName ] ; }
Gets the ajax url and route name.

@param FormInterface $form
@param array         $options

@return array The ajaxUrl and routeName
Gets the ajax url and route name .