YAML Content Import Events
Throughout the content import process, the YAML Content module dispatches a number of events that may be subscribed to. There are a number of reasons to implement an event subscriber to react to these events, but some of these include:
- Customization of content while it is being imported
- Dynamic alteration of content during import based on special conditions
- Creation of additional content alongside the imported content
- Additional manipulation of the system in reaction to new content being made available
- Dynamic processing not possible through content definition in YAML
All of the events dispatched throughout the import process are documented in the \Drupal\yaml_content\Event\YamlContentEvents class, but an overview of them is also available below.
Content Parsed
The event fired when a content file is parsed.
This event allows modules to perform an action whenever a content file is parsed for import. The event listener receives a \Drupal\yaml_content\Event\ContentParsedEvent instance.
Entity Pre-save
The event fired before an imported entity is saved.
This event allows modules to perform an action whenever an entity is prepared, but before it is saved. The event listener receives a \Drupal\yaml_content\Event\EntityPreSaveEvent instance.
Entity Post-save
The event fired after an imported entity is saved.
This event allows modules to perform an action whenever an entity is imported and saved. The event listener receives a \Drupal\yaml_content\Event\EntityPostSaveEvent instance.
Import Entity
The event fired before entity data is imported as a created entity.
This event allows modules to perform an action whenever entity data is about to be interpreted created as an entity. The event listener receives a \Drupal\yaml_content\Event\EntityImportEvent instance.
Import Field
The event fired before entity field data is imported and assigned.
This event allows modules to perform an action whenever field data is about to be interpreted and populated into an entity field. The event listener receives a \Drupal\yaml_content\Event\FieldImportEvent instance.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion