function CountryCodeConstraint::create
Same name in other branches
- 10 core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/CountryCodeConstraint.php \Drupal\Core\Validation\Plugin\Validation\Constraint\CountryCodeConstraint::create()
Overrides ContainerFactoryPluginInterface::create
1 call to CountryCodeConstraint::create()
- CountryCodeConstraintTest::testConstraintLoadsChoicesFromCountryManager in core/
tests/ Drupal/ Tests/ Core/ Validation/ Plugin/ Validation/ Constraint/ CountryCodeConstraintTest.php
File
-
core/
lib/ Drupal/ Core/ Validation/ Plugin/ Validation/ Constraint/ CountryCodeConstraint.php, line 23
Class
Namespace
Drupal\Core\Validation\Plugin\Validation\ConstraintCode
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) : Choice {
$countries = $container->get(CountryManagerInterface::class)
->getList();
$configuration['choices'] = array_keys($countries);
return new Choice($configuration);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.