public static function convertToDynamicLoader(ChoiceListFactoryInterface $choiceListFactory, Options $options, $value)
    {
        if ($value instanceof DynamicChoiceLoaderInterface) {
            return $value;
        }

        if (!\is_array($options['choices'])) {
            throw new InvalidConfigurationException('The "choice_loader" option must be an instance of DynamicChoiceLoaderInterface or the "choices" option must be an array');
        }

        if ($options['select2']['ajax']) {
            return new AjaxChoiceLoader(self::getChoices($options, $value),
                $choiceListFactory);
        }

        return new DynamicChoiceLoader(self::getChoices($options, $value),
            $choiceListFactory);
    }
public static function convertToDynamicLoader(ChoiceListFactoryInterface $choiceListFactory, Options $options, $value)
    {
        if ($value instanceof DynamicChoiceLoaderInterface) {
            return $value;
        }

        if (!\is_array($options['choices'])) {
            throw new InvalidConfigurationException('The "choice_loader" option must be an instance of DynamicChoiceLoaderInterface or the "choices" option must be an array');
        }

        if ($options['select2']['ajax']) {
            return new AjaxChoiceLoader(self::getChoices($options, $value),
                $choiceListFactory);
        }

        return new DynamicChoiceLoader(self::getChoices($options, $value),
            $choiceListFactory);
    }
public static function convertToDynamicLoader ( ChoiceListFactoryInterface $ choiceListFactory , Options $ options , $ value ) { if ( $ value instanceof DynamicChoiceLoaderInterface ) { return $ value ; } if ( ! \ is_array ( $ options [ 'choices' ] ) ) { throw new InvalidConfigurationException ( 'The "choice_loader" option must be an instance of DynamicChoiceLoaderInterface or the "choices" option must be an array' ) ; } if ( $ options [ 'select2' ] [ 'ajax' ] ) { return new AjaxChoiceLoader ( self :: getChoices ( $ options , $ value ) , $ choiceListFactory ) ; } return new DynamicChoiceLoader ( self :: getChoices ( $ options , $ value ) , $ choiceListFactory ) ; }
Convert the array to the ajax choice loader.

@param ChoiceListFactoryInterface                                  $choiceListFactory The choice list factory
@param Options                                                     $options           The options
@param DynamicChoiceLoaderInterface|AjaxChoiceLoaderInterface|null $value             The value of choice loader normalizer

@return DynamicChoiceLoaderInterface|AjaxChoiceLoaderInterface The dynamic choice loader
Convert the array to the ajax choice loader .