Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Locale.php

function Locale::__construct

Parameters

array<string,mixed>|null $options:

bool|null $canonicalize Whether to canonicalize the value before validation (defaults to true) (see {@see https://www.php.net/manual/en/locale.canonicalize.php}):

string[]|null $groups:

Overrides Constraint::__construct

File

vendor/symfony/validator/Constraints/Locale.php, line 42

Class

Locale
Validates that a value is a valid locale (e.g. fr, fr_FR, etc.).

Namespace

Symfony\Component\Validator\Constraints

Code

public function __construct(?array $options = null, ?string $message = null, ?bool $canonicalize = null, ?array $groups = null, mixed $payload = null) {
    if (!class_exists(Locales::class)) {
        throw new LogicException('The Intl component is required to use the Locale constraint. Try running "composer require symfony/intl".');
    }
    parent::__construct($options, $groups, $payload);
    $this->message = $message ?? $this->message;
    $this->canonicalize = $canonicalize ?? $this->canonicalize;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal