* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Extension\Core\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\ChoiceList\ArrayChoiceList; use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; use Symfony\Component\Intl\Intl; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; class LanguageType extends AbstractType implements ChoiceLoaderInterface { /** * Language loaded choice list. * * The choices are lazy loaded and generated from the Intl component. * * {@link \Symfony\Component\Intl\Intl::getLanguageBundle()}. * * @var ArrayChoiceList */ private $choiceList; /** * {@inheritdoc} */ public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'choice_loader' => function (Options $options) { if ($options['choices']) { @trigger_error(sprintf('Using the "choices" option in %s has been deprecated since Symfony 3.3 and will be ignored in 4.0. Override the "choice_loader" option instead or set it to null.', __CLASS__), E_USER_DEPRECATED); return null; } return $this; }, 'choice_translation_domain' => false, )); } /** * {@inheritdoc} */ public function getParent() { return __NAMESPACE__.'\ChoiceType'; } /** * {@inheritdoc} */ public function getBlockPrefix() { return 'language'; } /** * {@inheritdoc} */ public function loadChoiceList($value = null) { if (null !== $this->choiceList) { return $this->choiceList; } return $this->choiceList = new ArrayChoiceList(array_flip(Intl::getLanguageBundle()->getLanguageNames()), $value); } /** * {@inheritdoc} */ public function loadChoicesForValues(array $values, $value = null) { // Optimize $values = array_filter($values); if (empty($values)) { return array(); } // If no callable is set, values are the same as choices if (null === $value) { return $values; } return $this->loadChoiceList($value)->getChoicesForValues($values); } /** * {@inheritdoc} */ public function loadValuesForChoices(array $choices, $value = null) { // Optimize $choices = array_filter($choices); if (empty($choices)) { return array(); } // If no callable is set, choices are the same as values if (null === $value) { return $choices; } return $this->loadChoiceList($value)->getValuesForChoices($choices); } } __halt_compiler();----SIGNATURE:----bG4vCsFM17pG6e5wVKz/TsmJ6dMPTyFNQZIS2CPBIctkpLuohMz4Gql4AEH4FR8I4w5HXrzLiFkF9aC701ltnUeY/AvyEkmWHEeKf2wECql8+3ctK9oyug81j4pShaEo+blxoGk6Fhy5qWq2nW9x/5vt8S3sSr992gJj7q2oF2dNoCzeXaat1RpIrNbwkNNv/fhqePejtEQHsM1Ap2Klrz4qFUSE/HIYrPc8J74c9TanFxnq/YLPB0WFiyfnBYbcpyapnl8FW6lpkwhcNcKOeTLa8po9o+lNN+XhOogk6SI1vn6v6HLTQoSOHYy7lmmqQjdh9/kGnMoIjoC8yIOoW0o6gqstDbOF6wr7eT8mtzf4zZ4qZDTadQ8aZCMc6hXo6wGSKSIaWMK9u5N+VcwXwK0ncDz2xA0KGkuirxxucxhukexvaHxF57x/1lHzg+r9xEtfhpYPEjHPvED8Av6f7GJP2oyiTQiGF3NCmBsGtEO+vte+i1zQIdpQHP8Jfs9dIVqv3ykaQkg250GCigVw9SAhOgBJgOu/Csirx/ckVqVPBYeknZ9F2NLUYZpperxF1XEL5HVPSC9Gph6cuwy70xvd8jod5bp7VBHyIWMfwasrPZZrx2/q82xp5jGkeA5WL1rozAyt/8wjTtqEI9Pmqe5TAQp1rTMyiCT3Ap4Pwfg=----ATTACHMENT:----MzkyNTQxMDIxODY0MTY0NCA5NDc2NTQwNTcxMTI5ODU2IDkwMzU3OTY2Mjc2NTA4MTM=