You are here

public function RemoveParagraphParentId::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/RemoveParagraphParentId.php, line 21

Class

RemoveParagraphParentId
Subscribes to exclude Paragraph parent id.

Namespace

Drupal\acquia_contenthub\EventSubscriber\ExcludeContentField

Code

public function shouldExclude(ExcludeEntityFieldEvent $event) : bool {
  $entity = $event
    ->getEntity();
  return $entity instanceof Paragraph && $event
    ->getFieldName() === 'parent_id';
}