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

Breadcrumb

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

function Isbn::__construct

Parameters

self::ISBN_*|array<string,mixed>|null $type The type of ISBN to validate (i.e. {@see Isbn::ISBN_10}, {@see Isbn::ISBN_13} or null to accept both, defaults to null):

string|null $message If defined, this message has priority over the others:

string[]|null $groups:

array<string,mixed> $options:

Overrides Constraint::__construct

File

vendor/symfony/validator/Constraints/Isbn.php, line 57

Class

Isbn
Validates that a value is a valid ISBN according to ISBN-10 or ISBN-13 formats.

Namespace

Symfony\Component\Validator\Constraints

Code

public function __construct(string|array|null $type = null, ?string $message = null, ?string $isbn10Message = null, ?string $isbn13Message = null, ?string $bothIsbnMessage = null, ?array $groups = null, mixed $payload = null, array $options = []) {
    if (\is_array($type)) {
        $options = array_merge($type, $options);
    }
    elseif (null !== $type) {
        $options['value'] = $type;
    }
    parent::__construct($options, $groups, $payload);
    $this->message = $message ?? $this->message;
    $this->isbn10Message = $isbn10Message ?? $this->isbn10Message;
    $this->isbn13Message = $isbn13Message ?? $this->isbn13Message;
    $this->bothIsbnMessage = $bothIsbnMessage ?? $this->bothIsbnMessage;
}

API Navigation

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