You are here

class RemoveIdField in Acquia Content Hub 8.2

Subscribes to exclude entity id field.

Hierarchy

  • class \Drupal\acquia_contenthub\EventSubscriber\ExcludeContentField\ExcludeContentFieldBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
    • class \Drupal\acquia_contenthub\EventSubscriber\ExcludeContentField\RemoveIdField

Expanded class hierarchy of RemoveIdField

1 file declares its use of RemoveIdField
RemoveIdFieldTest.php in tests/src/Kernel/EventSubscriber/ExcludeContentField/RemoveIdFieldTest.php
1 string reference to 'RemoveIdField'
acquia_contenthub.services.yml in ./acquia_contenthub.services.yml
acquia_contenthub.services.yml
1 service uses RemoveIdField
entity_id.field.cdf.exclude in ./acquia_contenthub.services.yml
Drupal\acquia_contenthub\EventSubscriber\ExcludeContentField\RemoveIdField

File

src/EventSubscriber/ExcludeContentField/RemoveIdField.php, line 10

Namespace

Drupal\acquia_contenthub\EventSubscriber\ExcludeContentField
View source
class RemoveIdField extends ExcludeContentFieldBase {

  /**
   * {@inheritdoc}
   */
  public static $priority = 110;

  /**
   * {@inheritDoc}
   */
  public function shouldExclude(ExcludeEntityFieldEvent $event) : bool {
    if ($event
      ->getEntity()
      ->getEntityTypeId() === 'entity_subqueue') {
      return FALSE;
    }
    $entity_type = $event
      ->getEntity()
      ->getEntityType();
    return $event
      ->getFieldName() === $entity_type
      ->getKey('id');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ExcludeContentFieldBase::excludeContentField public function Sets the "exclude" flag.
ExcludeContentFieldBase::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
RemoveIdField::$priority public static property Priority of the subscriber. Overrides ExcludeContentFieldBase::$priority
RemoveIdField::shouldExclude public function Prevent entity fields from being added to the serialized output. Overrides ExcludeContentFieldBase::shouldExclude