MenuTreeHierarchyConstraint.php

Same filename in other branches
  1. 9 core/modules/menu_link_content/src/Plugin/Validation/Constraint/MenuTreeHierarchyConstraint.php
  2. 8.9.x core/modules/menu_link_content/src/Plugin/Validation/Constraint/MenuTreeHierarchyConstraint.php
  3. 10 core/modules/menu_link_content/src/Plugin/Validation/Constraint/MenuTreeHierarchyConstraint.php

Namespace

Drupal\menu_link_content\Plugin\Validation\Constraint

File

core/modules/menu_link_content/src/Plugin/Validation/Constraint/MenuTreeHierarchyConstraint.php

View source
<?php

namespace Drupal\menu_link_content\Plugin\Validation\Constraint;

use Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Validation\Attribute\Constraint;

/**
 * Validation constraint for changing the menu hierarchy in pending revisions.
 */
class MenuTreeHierarchyConstraint extends CompositeConstraintBase {
    
    /**
     * The default violation message.
     *
     * @var string
     */
    public $message = 'You can only change the hierarchy for the <em>published</em> version of this menu link.';
    
    /**
     * {@inheritdoc}
     */
    public function coversFields() {
        return [
            'parent',
            'weight',
        ];
    }

}

Classes

Title Deprecated Summary
MenuTreeHierarchyConstraint Validation constraint for changing the menu hierarchy in pending revisions.

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