function ConfigEntityType::getConstraints

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php \Drupal\Core\Config\Entity\ConfigEntityType::getConstraints()

Overrides EntityType::getConstraints

File

core/lib/Drupal/Core/Config/Entity/ConfigEntityType.php, line 193

Class

ConfigEntityType
Provides an implementation of a configuration entity type and its metadata.

Namespace

Drupal\Core\Config\Entity

Code

public function getConstraints() {
    $constraints = parent::getConstraints();
    // If there is an ID key for this config entity type, make it immutable by
    // default. Individual config entities can override this with an
    // `ImmutableProperties` constraint in their definition that is either empty,
    // or with an alternative set of immutable properties.
    $id_key = $this->getKey('id');
    if ($id_key) {
        $constraints += [
            'ImmutableProperties' => [
                $id_key,
            ],
        ];
    }
    return $constraints;
}

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