public function ChangedTime::processEntity in Entity Share 8.3
Method called on STAGE_PROCESS_ENTITY.
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.
array $entity_json_data: The entity JSON data.
Overrides ImportProcessorPluginBase::processEntity
File
- modules/
entity_share_client/ src/ Plugin/ EntityShareClient/ Processor/ ChangedTime.php, line 32
Class
- ChangedTime
- Update changed time.
Namespace
Drupal\entity_share_client\Plugin\EntityShareClient\ProcessorCode
public function processEntity(RuntimeImportContext $runtime_import_context, ContentEntityInterface $processed_entity, array $entity_json_data) {
$field_mappings = $runtime_import_context
->getFieldMappings();
$entity_type_id = $processed_entity
->getEntityTypeId();
$entity_bundle = $processed_entity
->bundle();
$changed_public_name = FALSE;
if (isset($field_mappings[$entity_type_id][$entity_bundle]['changed'])) {
$changed_public_name = $field_mappings[$entity_type_id][$entity_bundle]['changed'];
}
if ($changed_public_name && !empty($entity_json_data['attributes'][$changed_public_name]) && method_exists($processed_entity, 'setChangedTime')) {
$remote_changed_value = $entity_json_data['attributes'][$changed_public_name];
$remote_changed_timestamp = EntityShareUtility::convertChangedTime($remote_changed_value);
$processed_entity
->setChangedTime($remote_changed_timestamp);
}
}