public function DefaultDataProcessor::postEntitySave in Entity Share 8.3
Method called on STAGE_POST_ENTITY_SAVE.
If the plugin reacts to this stage.
Parameters
\Drupal\entity_share_client\RuntimeImportContext $runtime_import_context: The import context.
\Drupal\Core\Entity\ContentEntityInterface $processed_entity: The entity being processed.
Overrides ImportProcessorPluginBase::postEntitySave
File
- modules/
entity_share_client/ src/ Plugin/ EntityShareClient/ Processor/ DefaultDataProcessor.php, line 171
Class
- DefaultDataProcessor
- General default data processor.
Namespace
Drupal\entity_share_client\Plugin\EntityShareClient\ProcessorCode
public function postEntitySave(RuntimeImportContext $runtime_import_context, ContentEntityInterface $processed_entity) {
// Create or update the dedicated "Entity import status" entity.
// At this point the entity has been successfully imported.
$import_status_entity = $this->stateInformation
->getImportStatusOfEntity($processed_entity);
if (!$import_status_entity) {
// If a dedicated "Entity import status" entity doesn't exist (which
// means that either this is a new imported entity, or it is a "legacy"
// content imported before the introduction of "Entity import status"
// entities), create it.
$parameters = [
'remote_website' => $runtime_import_context
->getRemote()
->id(),
'channel_id' => $runtime_import_context
->getChannelId(),
];
$this->stateInformation
->createImportStatusOfEntity($processed_entity, $parameters);
}
else {
// "Entity import status" exists, just update the last import timestamp.
$import_status_entity
->setLastImport($this->time
->getRequestTime())
->save();
}
}