Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
link
Commits
1c815988
Commit
1c815988
authored
Dec 12, 2019
by
osopolar
Committed by
Damien McKenna
Dec 12, 2019
Browse files
Issue #2537248 by osopolar, Ronino, DamienMcKenna: Allow title without url on migration.
parent
7f65b557
Changes
2
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.txt
View file @
1c815988
Link 7.x-1.x-dev, xxxx-xx-xx
----------------------------
#2537248 by osopolar, Ronino, DamienMcKenna: Allow title without url on
migration.
Link 7.x-1.7, 2019-11-14
...
...
link.migrate.inc
View file @
1c815988
...
...
@@ -102,7 +102,28 @@ class MigrateLinkFieldHandler extends MigrateFieldHandler {
}
$language
=
$this
->
getFieldLanguage
(
$entity
,
$field_info
,
$arguments
);
$values
=
array_filter
(
$values
);
// URLs are numeric array elements, keyed by delta. As those elements don't
// exist for empty URLs they are allowed and it's up to the developer what
// data to migrate, add elements for those URLs up to the maximum delta
// found.
//
// First of all, determine the maximum delta from non-empty URLs.
$max_delta
=
max
(
array_merge
(
array
(
0
),
array_keys
(
$values
)));
// Next, determine the max delta from arguments.
foreach
(
$arguments
as
$key
=>
$value
)
{
if
(
is_array
(
$value
))
{
$max_delta
=
max
(
$max_delta
,
max
(
array_keys
(
$value
)));
}
}
// Finally, add missing elements for empty URLs.
for
(
$delta
=
0
;
$delta
<=
$max_delta
;
$delta
++
)
{
if
(
!
isset
(
$values
[
$delta
]))
{
$values
[
$delta
]
=
''
;
}
}
foreach
(
$values
as
$delta
=>
$value
)
{
$item
=
array
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment