TaxonomyTermHierarchyConstraint.php

Same filename in other branches
  1. 8.9.x core/modules/taxonomy/src/Plugin/Validation/Constraint/TaxonomyTermHierarchyConstraint.php
  2. 10 core/modules/taxonomy/src/Plugin/Validation/Constraint/TaxonomyTermHierarchyConstraint.php
  3. 11.x core/modules/taxonomy/src/Plugin/Validation/Constraint/TaxonomyTermHierarchyConstraint.php

Namespace

Drupal\taxonomy\Plugin\Validation\Constraint

File

core/modules/taxonomy/src/Plugin/Validation/Constraint/TaxonomyTermHierarchyConstraint.php

View source
<?php

namespace Drupal\taxonomy\Plugin\Validation\Constraint;

use Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase;

/**
 * Validation constraint for changing the term hierarchy in pending revisions.
 *
 * @Constraint(
 *   id = "TaxonomyHierarchy",
 *   label = @Translation("Taxonomy term hierarchy.", context = "Validation"),
 * )
 */
class TaxonomyTermHierarchyConstraint extends CompositeConstraintBase {
    
    /**
     * The default violation message.
     *
     * @var string
     */
    public $message = 'You can only change the hierarchy for the <em>published</em> version of this term.';
    
    /**
     * {@inheritdoc}
     */
    public function coversFields() {
        return [
            'parent',
            'weight',
        ];
    }

}

Classes

Title Deprecated Summary
TaxonomyTermHierarchyConstraint Validation constraint for changing the term hierarchy in pending revisions.

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