LangcodeRequiredIfTranslatableValuesConstraint.php

Same filename and directory in other branches
  1. 11.x core/lib/Drupal/Core/Config/Plugin/Validation/Constraint/LangcodeRequiredIfTranslatableValuesConstraint.php

Namespace

Drupal\Core\Config\Plugin\Validation\Constraint

File

core/lib/Drupal/Core/Config/Plugin/Validation/Constraint/LangcodeRequiredIfTranslatableValuesConstraint.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Core\Config\Plugin\Validation\Constraint;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Validation\Attribute\Constraint;
use Symfony\Component\Validator\Constraint as SymfonyConstraint;
class LangcodeRequiredIfTranslatableValuesConstraint extends SymfonyConstraint {
  
  /**
   * The error message if this config object is missing a `langcode`.
   *
   * @var string
   */
  public string $missingMessage = "The @name config object must specify a language code, because it contains translatable values.";
  
  /**
   * The error message if this config object contains a superfluous `langcode`.
   *
   * @var string
   */
  public string $superfluousMessage = "The @name config object does not contain any translatable values, so it should not specify a language code.";

}

Classes

Title Deprecated Summary
LangcodeRequiredIfTranslatableValuesConstraint #[Constraint(id: 'LangcodeRequiredIfTranslatableValues', label: new TranslatableMarkup('Translatable config has langcode', [], [ 'context' => 'Validation', ]), type: [ 'config_object', ])]

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