function ContentEntityType::setRevisionMetadataKey
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Entity/ContentEntityType.php \Drupal\Core\Entity\ContentEntityType::setRevisionMetadataKey()
- 10 core/lib/Drupal/Core/Entity/ContentEntityType.php \Drupal\Core\Entity\ContentEntityType::setRevisionMetadataKey()
- 11.x 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 120
Class
- ContentEntityType
- Provides an implementation of a content entity type and its metadata.
Namespace
Drupal\Core\EntityCode
public function setRevisionMetadataKey($key, $field_name) {
if ($field_name !== NULL) {
// Update the property holding the required revision metadata keys,
// which is used by the BC layer for retrieving the revision metadata
// keys.
// @see \Drupal\Core\Entity\ContentEntityType::getRevisionMetadataKeys()
$this->requiredRevisionMetadataKeys[$key] = $field_name;
// Add the new revision metadata key.
$this->revision_metadata_keys[$key] = $field_name;
}
else {
unset($this->requiredRevisionMetadataKeys[$key], $this->revision_metadata_keys[$key]);
}
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.