Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
entity_share
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
entity_share
Merge requests
!86
Can't import media image if the image field be rename by json_extra
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Can't import media image if the image field be rename by json_extra
issue/entity_share-3411886:3411886-cant-import-media
into
8.x-3.x
Overview
0
Commits
1
Pipelines
0
Changes
1
Open
Lawxen Liu
requested to merge
issue/entity_share-3411886:3411886-cant-import-media
into
8.x-3.x
1 year ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
Closes
#3411886
0
0
Merge request reports
Compare
8.x-3.x
8.x-3.x (HEAD)
and
latest version
latest version
56d44077
1 commit,
1 year ago
1 file
+
3
−
5
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
modules/entity_share_client/src/Plugin/EntityShareClient/Processor/EntityReference.php
+
3
−
5
Options
@@ -114,15 +114,13 @@ class EntityReference extends ImportProcessorPluginBase implements PluginFormInt
*/
public
function
processEntity
(
RuntimeImportContext
$runtime_import_context
,
ContentEntityInterface
$processed_entity
,
array
$entity_json_data
)
{
if
(
isset
(
$entity_json_data
[
'relationships'
]))
{
$field_mappings
=
$runtime_import_context
->
getFieldMappings
();
// Loop on reference fields.
foreach
(
$entity_json_data
[
'relationships'
]
as
$field_public_name
=>
$field_data
)
{
$field_internal_name
=
array_search
(
$field_public_name
,
$field_mappings
[
$processed_entity
->
getEntityTypeId
()][
$processed_entity
->
bundle
()]);
if
(
!
$processed_entity
->
hasField
(
$field_internal_name
))
{
$this
->
logger
->
notice
(
'Error during import. The field @field does not exist.'
,
[
'@field'
=>
$field_internal_name
]);
if
(
!
$processed_entity
->
hasField
(
$field_public_name
))
{
$this
->
logger
->
notice
(
'Error during import. The field @field does not exist.'
,
[
'@field'
=>
$field_public_name
]);
continue
;
}
$field
=
$processed_entity
->
get
(
$field_
internal
_name
);
$field
=
$processed_entity
->
get
(
$field_
public
_name
);
if
(
$this
->
entityReferenceHelper
->
relationshipHandleable
(
$field
)
!==
EntityReferenceHelperInterface
::
RELATIONSHIP_HANDLEABLE
)
{
continue
;
Loading