LinkNotExistingInternalConstraint.php

Same filename and directory in other branches
  1. 10 core/modules/link/src/Plugin/Validation/Constraint/LinkNotExistingInternalConstraint.php
  2. 9 core/modules/link/src/Plugin/Validation/Constraint/LinkNotExistingInternalConstraint.php
  3. 8.9.x core/modules/link/src/Plugin/Validation/Constraint/LinkNotExistingInternalConstraint.php
  4. main core/modules/link/src/Plugin/Validation/Constraint/LinkNotExistingInternalConstraint.php

Namespace

Drupal\link\Plugin\Validation\Constraint

File

core/modules/link/src/Plugin/Validation/Constraint/LinkNotExistingInternalConstraint.php

View source
<?php

namespace Drupal\link\Plugin\Validation\Constraint;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Validation\Attribute\Constraint;
use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint as SymfonyConstraint;

/**
 * Defines a protocol validation constraint for links to broken internal URLs.
 */
class LinkNotExistingInternalConstraint extends SymfonyConstraint {
  public function __construct(mixed $options = NULL, public string $message = '', public string $notFoundMessage = "The URL '@uri' doesn't exist.", public string $invalidParameterMessage = "The URL '@uri' has an invalid parameter.", public string $missingParameterMessage = "The URL '@uri' is missing a required parameter.", ?array $groups = NULL, mixed $payload = NULL) {
    if ($message !== '') {
      @trigger_error('Passing the $message argument to ' . __METHOD__ . '() is deprecated in drupal:11.5.0 and is removed from drupal:12.0.0. Use the $notFoundMessage argument instead. See https://www.drupal.org/node/3614626', E_USER_DEPRECATED);
      if ($this->notFoundMessage === "The URL '@uri' doesn't exist.") {
        $this->notFoundMessage = $message;
      }
    }
    parent::__construct($options, $groups, $payload);
  }

}

Classes

Title Deprecated Summary
LinkNotExistingInternalConstraint Defines a protocol validation constraint for links to broken internal URLs.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.