Commit 392522c0 authored by alexpott's avatar alexpott
Browse files

Issue #2363643 by ultimike | benjy: Fixed Nodes with format 0 are skipped.

parent 9872c3ae
...@@ -20,16 +20,9 @@ process: ...@@ -20,16 +20,9 @@ process:
promote: promote promote: promote
sticky: sticky sticky: sticky
'body/format': 'body/format':
- plugin: migration
plugin: static_map migration: d6_filter_format
bypass: true source: format
source: format
map:
0: NULL
-
plugin: migration
migration: d6_filter_format
no_stub: 1
'body/value': body 'body/value': body
'body/summary': teaser 'body/summary': teaser
revision_uid: uid revision_uid: uid
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\migrate_drupal\Plugin\migrate\source\d6; namespace Drupal\migrate_drupal\Plugin\migrate\source\d6;
use Drupal\migrate\Row;
use Drupal\migrate\Plugin\SourceEntityInterface; use Drupal\migrate\Plugin\SourceEntityInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase; use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
...@@ -24,6 +25,13 @@ class Node extends DrupalSqlBase implements SourceEntityInterface { ...@@ -24,6 +25,13 @@ class Node extends DrupalSqlBase implements SourceEntityInterface {
*/ */
const JOIN = 'n.vid = nr.vid'; const JOIN = 'n.vid = nr.vid';
/**
* The default filter format.
*
* @var string
*/
protected $filterDefaultFormat;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -63,6 +71,14 @@ public function query() { ...@@ -63,6 +71,14 @@ public function query() {
return $query; return $query;
} }
/**
* {@inheritdoc}
*/
protected function runQuery() {
$this->filterDefaultFormat = $this->variableGet('filter_default_format', '1');
return parent::runQuery();
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -88,6 +104,18 @@ public function fields() { ...@@ -88,6 +104,18 @@ public function fields() {
return $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} * {@inheritdoc}
*/ */
......
...@@ -87,8 +87,8 @@ public function testNode() { ...@@ -87,8 +87,8 @@ public function testNode() {
$this->assertEqual($node->body->format, 'full_html'); $this->assertEqual($node->body->format, 'full_html');
$node = Node::load(3); $node = Node::load(3);
// Test that format = 0 from source maps to NULL. // Test that format = 0 from source maps to filtered_html.
$this->assertIdentical($node->body->format, NULL); $this->assertIdentical($node->body->format, 'filtered_html');
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment