public function LinkInternalContentImporter::prepareImportableEntityData in Entity Share 8.3
Method called on STAGE_PREPARE_IMPORTABLE_ENTITY_DATA.
If the plugin reacts to this stage.
Parameters
\Drupal\entity_share_client\RuntimeImportContext $runtime_import_context: The import context.
array $entity_json_data: The entity JSON data.
Overrides ImportProcessorPluginBase::prepareImportableEntityData
File
- modules/
entity_share_client/ src/ Plugin/ EntityShareClient/ Processor/ LinkInternalContentImporter.php, line 31
Class
- LinkInternalContentImporter
- Import internal content from Link fields.
Namespace
Drupal\entity_share_client\Plugin\EntityShareClient\ProcessorCode
public function prepareImportableEntityData(RuntimeImportContext $runtime_import_context, array &$entity_json_data) {
if (isset($entity_json_data['attributes']) && is_array($entity_json_data['attributes'])) {
foreach ($entity_json_data['attributes'] as $field_name => $field_data) {
if (is_array($field_data)) {
if (EntityShareUtility::isNumericArray($field_data)) {
foreach ($field_data as $delta => $value) {
if (isset($value['content_entity_href'])) {
$entity_json_data['attributes'][$field_name][$delta]['uri'] = $this
->processLink($runtime_import_context, $value['uri'], $value['content_entity_href']);
}
}
}
elseif (isset($field_data['content_entity_href'])) {
$entity_json_data['attributes'][$field_name]['uri'] = $this
->processLink($runtime_import_context, $field_data['uri'], $field_data['content_entity_href']);
}
}
}
}
}