Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
392522c0
Commit
392522c0
authored
Nov 01, 2014
by
alexpott
Browse files
Issue
#2363643
by ultimike | benjy: Fixed Nodes with format 0 are skipped.
parent
9872c3ae
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/modules/migrate_drupal/config/install/migrate.migration.d6_node.yml
View file @
392522c0
...
...
@@ -20,16 +20,9 @@ process:
promote
:
promote
sticky
:
sticky
'
body/format'
:
-
plugin
:
static_map
bypass
:
true
source
:
format
map
:
0
:
NULL
-
plugin
:
migration
migration
:
d6_filter_format
no_stub
:
1
plugin
:
migration
migration
:
d6_filter_format
source
:
format
'
body/value'
:
body
'
body/summary'
:
teaser
revision_uid
:
uid
...
...
core/modules/migrate_drupal/src/Plugin/migrate/source/d6/Node.php
View file @
392522c0
...
...
@@ -7,6 +7,7 @@
namespace
Drupal\migrate_drupal\Plugin\migrate\source\d6
;
use
Drupal\migrate\Row
;
use
Drupal\migrate\Plugin\SourceEntityInterface
;
use
Drupal\migrate_drupal
\
Plugin\migrate\source\DrupalSqlBase
;
...
...
@@ -24,6 +25,13 @@ class Node extends DrupalSqlBase implements SourceEntityInterface {
*/
const
JOIN
=
'n.vid = nr.vid'
;
/**
* The default filter format.
*
* @var string
*/
protected
$filterDefaultFormat
;
/**
* {@inheritdoc}
*/
...
...
@@ -63,6 +71,14 @@ public function query() {
return
$query
;
}
/**
* {@inheritdoc}
*/
protected
function
runQuery
()
{
$this
->
filterDefaultFormat
=
$this
->
variableGet
(
'filter_default_format'
,
'1'
);
return
parent
::
runQuery
();
}
/**
* {@inheritdoc}
*/
...
...
@@ -88,6 +104,18 @@ public function fields() {
return
$fields
;
}
/**
* {@inheritdoc}
*/
public
function
prepareRow
(
Row
$row
)
{
// format = 0 can happen when the body field is hidden. Set the format to 1
// to avoid migration map issues (since the body field isn't used anyway).
if
(
$row
->
getSourceProperty
(
'format'
)
===
'0'
)
{
$row
->
setSourceProperty
(
'format'
,
$this
->
filterDefaultFormat
);
}
return
parent
::
prepareRow
(
$row
);
}
/**
* {@inheritdoc}
*/
...
...
core/modules/migrate_drupal/src/Tests/d6/MigrateNodeTest.php
View file @
392522c0
...
...
@@ -87,8 +87,8 @@ public function testNode() {
$this
->
assertEqual
(
$node
->
body
->
format
,
'full_html'
);
$node
=
Node
::
load
(
3
);
// Test that format = 0 from source maps to
NULL
.
$this
->
assertIdentical
(
$node
->
body
->
format
,
NULL
);
// Test that format = 0 from source maps to
filtered_html
.
$this
->
assertIdentical
(
$node
->
body
->
format
,
'filtered_html'
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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