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

Breadcrumb

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

function Language::__construct

Same name in this branch
  1. 11.1.x core/lib/Drupal/Core/Language/Language.php \Drupal\Core\Language\Language::__construct()
  2. 11.1.x core/modules/language/src/Plugin/Condition/Language.php \Drupal\language\Plugin\Condition\Language::__construct()
  3. 11.1.x core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Language.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Language::__construct()

Parameters

array<string,mixed>|null $options:

bool|null $alpha3 Pass true to validate the language with three-letter code (ISO 639-2 (2T)) or false with two-letter code (ISO 639-1) (defaults to false):

string[]|null $groups:

Overrides Constraint::__construct

File

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

Class

Language
Validates that a value is a valid language Unicode language identifier.

Namespace

Symfony\Component\Validator\Constraints

Code

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

API Navigation

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