You are here

public function RemoveRevisionField::shouldExclude in Acquia Content Hub 8.2

Prevent entity fields from being added to the serialized output.

Parameters

\Drupal\acquia_contenthub\Event\ExcludeEntityFieldEvent $event: The content entity field serialization event.

Overrides ExcludeContentFieldBase::shouldExclude

File

src/EventSubscriber/ExcludeContentField/RemoveRevisionField.php, line 20

Class

RemoveRevisionField
Subscribes to exclude entity revision field.

Namespace

Drupal\acquia_contenthub\EventSubscriber\ExcludeContentField

Code

public function shouldExclude(ExcludeEntityFieldEvent $event) : bool {
  $entity_type = $event
    ->getEntity()
    ->getEntityType();
  return $event
    ->getFieldName() === $entity_type
    ->getKey('revision');
}