function ContentEntityType::getRevisionMetadataKeys
Gets an array of entity revision metadata keys.
Parameters
bool $include_backwards_compatibility_field_names: (optional and deprecated) Whether to provide the revision keys on a best-effort basis by looking at the base fields defined by the entity type. Note that this parameter will be removed in Drupal 9.0.0. Defaults to TRUE.
Return value
array An array describing how the Field API can extract revision metadata information of this entity type:
- revision_log_message: The name of the property that contains description of the changes that were made in the current revision.
- revision_user: The name of the property that contains the user ID of the author of the current revision.
- revision_created: The name of the property that contains the timestamp of the current revision.
Overrides ContentEntityTypeInterface::getRevisionMetadataKeys
2 calls to ContentEntityType::getRevisionMetadataKeys()
- ContentEntityType::getRevisionMetadataKey in core/
lib/ Drupal/ Core/ Entity/ ContentEntityType.php - Gets a specific entity revision metadata key.
- ContentEntityType::hasRevisionMetadataKey in core/
lib/ Drupal/ Core/ Entity/ ContentEntityType.php - Indicates if a given entity revision metadata key exists.
File
-
core/
lib/ Drupal/ Core/ Entity/ ContentEntityType.php, line 80
Class
- ContentEntityType
- Provides an implementation of a content entity type and its metadata.
Namespace
Drupal\Core\EntityCode
public function getRevisionMetadataKeys($include_backwards_compatibility_field_names = TRUE) {
// Provide backwards compatibility in case the revision metadata keys are
// not defined in the entity annotation.
if ((!$this->revision_metadata_keys || $this->revision_metadata_keys == $this->requiredRevisionMetadataKeys) && $include_backwards_compatibility_field_names) {
$base_fields = \Drupal::service('entity_field.manager')->getBaseFieldDefinitions($this->id());
if (isset($base_fields['revision_uid']) && ($revision_user = 'revision_uid') || isset($base_fields['revision_user']) && $revision_user = 'revision_user') {
@trigger_error('The revision_user revision metadata key is not set for entity type: ' . $this->id . ' See: https://www.drupal.org/node/2831499', E_USER_DEPRECATED);
$this->revision_metadata_keys['revision_user'] = $revision_user;
}
if (isset($base_fields['revision_timestamp']) && ($revision_timestamp = 'revision_timestamp') || isset($base_fields['revision_created']) && $revision_timestamp = 'revision_created') {
@trigger_error('The revision_created revision metadata key is not set for entity type: ' . $this->id . ' See: https://www.drupal.org/node/2831499', E_USER_DEPRECATED);
$this->revision_metadata_keys['revision_created'] = $revision_timestamp;
}
if (isset($base_fields['revision_log']) && ($revision_log = 'revision_log') || isset($base_fields['revision_log_message']) && $revision_log = 'revision_log_message') {
@trigger_error('The revision_log_message revision metadata key is not set for entity type: ' . $this->id . ' See: https://www.drupal.org/node/2831499', E_USER_DEPRECATED);
$this->revision_metadata_keys['revision_log_message'] = $revision_log;
}
}
return $this->revision_metadata_keys;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.