Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3253639
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
drupal-3253639
Commits
d6f56940
Commit
d6f56940
authored
9 years ago
by
catch
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2633568
by quietone, ultimike: Improve method for migrating link attributes from D6
parent
0ec00a50
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/modules/link/src/Plugin/migrate/process/d6/CckLink.php
+4
-0
4 additions, 0 deletions
core/modules/link/src/Plugin/migrate/process/d6/CckLink.php
core/modules/node/src/Tests/Migrate/d6/MigrateNodeTest.php
+24
-0
24 additions, 0 deletions
core/modules/node/src/Tests/Migrate/d6/MigrateNodeTest.php
with
28 additions
and
0 deletions
core/modules/link/src/Plugin/migrate/process/d6/CckLink.php
+
4
−
0
View file @
d6f56940
...
@@ -51,6 +51,10 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
...
@@ -51,6 +51,10 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
$attributes
=
unserialize
(
$attributes
);
$attributes
=
unserialize
(
$attributes
);
}
}
if
(
!
$attributes
)
{
$attributes
=
[];
}
// Massage the values into the correct form for the link.
// Massage the values into the correct form for the link.
$route
[
'uri'
]
=
$value
[
'url'
];
$route
[
'uri'
]
=
$value
[
'url'
];
$route
[
'options'
][
'attributes'
]
=
$attributes
;
$route
[
'options'
][
'attributes'
]
=
$attributes
;
...
...
This diff is collapsed.
Click to expand it.
core/modules/node/src/Tests/Migrate/d6/MigrateNodeTest.php
+
24
−
0
View file @
d6f56940
...
@@ -79,6 +79,30 @@ public function testNode() {
...
@@ -79,6 +79,30 @@ public function testNode() {
$this
->
assertIdentical
(
'test rev 3'
,
$node
->
body
->
value
);
$this
->
assertIdentical
(
'test rev 3'
,
$node
->
body
->
value
);
$this
->
assertIdentical
(
'filtered_html'
,
$node
->
body
->
format
);
$this
->
assertIdentical
(
'filtered_html'
,
$node
->
body
->
format
);
// Test that link fields are migrated.
$this
->
assertIdentical
(
'http://groups.drupal.org/'
,
$node
->
field_test_link
->
uri
);
$this
->
assertIdentical
(
'Drupal Groups'
,
$node
->
field_test_link
->
title
);
$this
->
assertIdentical
([],
$node
->
field_test_link
->
options
[
'attributes'
]);
// Rerun migration with invalid link attributes and a different URL and
// title. If only the attributes are changed the error does not occur.
Database
::
getConnection
(
'default'
,
'migrate'
)
->
update
(
'content_type_story'
)
->
fields
([
'field_test_link_url'
=>
'https://www.drupal.org/node/2127611'
,
'field_test_link_title'
=>
'Migrate API in Drupal 8'
,
'field_test_link_attributes'
=>
''
,
])
->
condition
(
'nid'
,
'2'
)
->
condition
(
'vid'
,
'3'
)
->
execute
();
$this
->
rerunMigration
();
$node
=
Node
::
load
(
2
);
$this
->
assertIdentical
(
'https://www.drupal.org/node/2127611'
,
$node
->
field_test_link
->
uri
);
$this
->
assertIdentical
(
'Migrate API in Drupal 8'
,
$node
->
field_test_link
->
title
);
$this
->
assertIdentical
([],
$node
->
field_test_link
->
options
[
'attributes'
]);
// Test that we can re-import using the EntityContentBase destination.
// Test that we can re-import using the EntityContentBase destination.
$title
=
$this
->
rerunMigration
();
$title
=
$this
->
rerunMigration
();
$node
=
Node
::
load
(
2
);
$node
=
Node
::
load
(
2
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment