function PreExportEvent::setEntityKeyExportable
Toggles whether a specific entity key should be exported.
Parameters
string $key: An entity key, e.g. `uuid` or `langcode`. Can be a regular entity key, or a revision metadata key.
bool $export: Whether to export the entity key, even if it is computed.
File
-
core/
lib/ Drupal/ Core/ DefaultContent/ PreExportEvent.php, line 54
Class
- PreExportEvent
- Event dispatched before an entity is exported as default content.
Namespace
Drupal\Core\DefaultContentCode
public function setEntityKeyExportable(string $key, bool $export = TRUE) : void {
$entity_type = $this->entity
->getEntityType();
assert($entity_type instanceof ContentEntityTypeInterface);
if ($entity_type->hasKey($key)) {
$this->setExportable($entity_type->getKey($key), $export);
}
elseif ($entity_type->hasRevisionMetadataKey($key)) {
$this->setExportable($entity_type->getRevisionMetadataKey($key), $export);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.