Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

RequiredConfigDependenciesConstraint.php

Namespace

Drupal\Core\Config\Plugin\Validation\Constraint

File

core/lib/Drupal/Core/Config/Plugin/Validation/Constraint/RequiredConfigDependenciesConstraint.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;

/**
 * Checks that config dependencies contain specific types of entities.
 */
class RequiredConfigDependenciesConstraint extends SymfonyConstraint {
    
    /**
     * The error message.
     *
     * @var string
     */
    public string $message = 'This @entity_type requires a @dependency_type.';
    
    /**
     * The IDs of entity types that need to exist in config dependencies.
     *
     * For example, if an entity requires a filter format in its config
     * dependencies, this should contain `filter_format`.
     *
     * @var string[]
     */
    public array $entityTypes = [];
    
    /**
     * {@inheritdoc}
     */
    public function getRequiredOptions() : array {
        return [
            'entityTypes',
        ];
    }
    
    /**
     * {@inheritdoc}
     */
    public function getDefaultOption() : ?string {
        return 'entityTypes';
    }

}

Classes

Title Deprecated Summary
RequiredConfigDependenciesConstraint Checks that config dependencies contain specific types of entities.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal