class RemovePathAliasField in Acquia Content Hub 8.2
Subscribes to exclude path alias field.
Hierarchy
- class \Drupal\acquia_contenthub\EventSubscriber\ExcludeContentField\ExcludeContentFieldBase implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
- class \Drupal\acquia_contenthub\EventSubscriber\ExcludeContentField\RemovePathAliasField
Expanded class hierarchy of RemovePathAliasField
1 file declares its use of RemovePathAliasField
- RemovePathAliasFieldTest.php in tests/
src/ Kernel/ EventSubscriber/ ExcludeContentField/ RemovePathAliasFieldTest.php
1 string reference to 'RemovePathAliasField'
1 service uses RemovePathAliasField
File
- src/
EventSubscriber/ ExcludeContentField/ RemovePathAliasField.php, line 10
Namespace
Drupal\acquia_contenthub\EventSubscriber\ExcludeContentFieldView source
class RemovePathAliasField extends ExcludeContentFieldBase {
/**
* {@inheritdoc}
*/
public static $priority = 60;
/**
* {@inheritDoc}
*/
public function shouldExclude(ExcludeEntityFieldEvent $event) : bool {
// As we are not supporting Drupal version 8.7 and after 8.8 path alias
// is an entity that's why prevent it from being added to the
// serialized output.
return $event
->getEntity()
->getEntityTypeId() !== 'path_alias' && $event
->getFieldName() === 'path';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ExcludeContentFieldBase:: |
public | function | Sets the "exclude" flag. | |
ExcludeContentFieldBase:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
RemovePathAliasField:: |
public static | property |
Priority of the subscriber. Overrides ExcludeContentFieldBase:: |
|
RemovePathAliasField:: |
public | function |
Prevent entity fields from being added to the serialized output. Overrides ExcludeContentFieldBase:: |