You are here

public function ContentEntityType::setRevisionMetadataKey in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/ContentEntityType.php \Drupal\Core\Entity\ContentEntityType::setRevisionMetadataKey()

Sets a revision metadata key.

Parameters

string $key: The name of the entity revision metadata key to set.

string|null $field_name: The name of the entity field key to use for the revision metadata key. If NULL is passed, the value of the revision metadata key is unset.

Return value

$this

Overrides ContentEntityTypeInterface::setRevisionMetadataKey

File

core/lib/Drupal/Core/Entity/ContentEntityType.php, line 82

Class

ContentEntityType
Provides an implementation of a content entity type and its metadata.

Namespace

Drupal\Core\Entity

Code

public function setRevisionMetadataKey($key, $field_name) {
  if ($field_name !== NULL) {
    $this->revision_metadata_keys[$key] = $field_name;
  }
  else {
    unset($this->revision_metadata_keys[$key]);
  }
  return $this;
}