pm-4.1.x-dev/src/Plugin/Validation/Constraint/PmExclusiveChildConstraint.php

src/Plugin/Validation/Constraint/PmExclusiveChildConstraint.php
<?php

declare(strict_types=1);

namespace Drupal\pm\Plugin\Validation\Constraint;

use Symfony\Component\Validator\Constraint;

/**
 * Provides an Exclusive Child constraint.
 *
 * @Constraint(
 *   id = "PMExclusiveChild",
 *   label = @Translation("Exclusive Child", context = "Validation"),
 * )
 *
 * @DCG
 * To apply this constraint on third party field types. Implement
 * hook_field_info_alter() as follows.
 * @code
 * function pm_field_info_alter(array &$info): void {
 *   $info['FIELD_TYPE']['constraints']['PMExclusiveChild'] = [];
 * }
 * @endcode
 *
 * @see https://www.drupal.org/node/2015723
 */
final class PmExclusiveChildConstraint extends Constraint {

  /**
   * The message shown when constraints are not met.
   * @var string
   */
  public string $message = 'Cannot re-use "%label (%id)" as it is already associated with another "%parent_label".';

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc