diff --git a/core/modules/filter/migration_templates/d6_filter_format.yml b/core/modules/filter/migration_templates/d6_filter_format.yml index 16982d3..abfb0f2 100644 --- a/core/modules/filter/migration_templates/d6_filter_format.yml +++ b/core/modules/filter/migration_templates/d6_filter_format.yml @@ -34,8 +34,6 @@ process: - filter_url - filter_htmlcorrector - filter_html_escape - php: - - php_code settings: settings status: plugin: default_value diff --git a/core/modules/filter/migration_templates/d7_filter_format.yml b/core/modules/filter/migration_templates/d7_filter_format.yml index 01f820c..bd3f637 100755 --- a/core/modules/filter/migration_templates/d7_filter_format.yml +++ b/core/modules/filter/migration_templates/d7_filter_format.yml @@ -8,6 +8,20 @@ process: format: format name: name cache: cache - filters: filters + filters: + plugin: iterator + source: filters + key: @id + process: + id: + plugin: static_map + bypass: true + source: name + map: + php_code: filter_null + settings: settings + status: + plugin: default_value + default_value: true destination: plugin: entity:filter_format diff --git a/core/modules/filter/src/Tests/Migrate/d6/MigrateFilterFormatTest.php b/core/modules/filter/src/Tests/Migrate/d6/MigrateFilterFormatTest.php index febea32..c6e2da7 100644 --- a/core/modules/filter/src/Tests/Migrate/d6/MigrateFilterFormatTest.php +++ b/core/modules/filter/src/Tests/Migrate/d6/MigrateFilterFormatTest.php @@ -7,6 +7,7 @@ namespace Drupal\filter\Tests\Migrate\d6; +use Drupal\filter\Entity\FilterFormat; use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase; /** @@ -22,18 +23,11 @@ class MigrateFilterFormatTest extends MigrateDrupal6TestBase { static $modules = array('filter'); /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - $this->executeMigration('d6_filter_format'); - } - - /** * Tests the Drupal 6 filter format to Drupal 8 migration. */ public function testFilterFormat() { - $filter_format = entity_load('filter_format', 'filtered_html'); + $this->executeMigration('d6_filter_format'); + $filter_format = FilterFormat::load('filtered_html'); // Check filter status. $filters = $filter_format->get('filters'); @@ -52,6 +46,10 @@ public function testFilterFormat() { $this->assertIdentical(TRUE, $filters['filter_html']['settings']['filter_html_help']); $this->assertIdentical(FALSE, $filters['filter_html']['settings']['filter_html_nofollow']); $this->assertIdentical(72, $filters['filter_url']['settings']['filter_url_length']); + + // Check that the PHP code filter is converted to filter_null. + $filters = FilterFormat::load('php_code')->get('filters'); + $this->assertTrue(isset($filters['filter_null'])); } } diff --git a/core/modules/filter/src/Tests/Migrate/d7/MigrateFilterFormatTest.php b/core/modules/filter/src/Tests/Migrate/d7/MigrateFilterFormatTest.php index 129c278..0b84b8b 100644 --- a/core/modules/filter/src/Tests/Migrate/d7/MigrateFilterFormatTest.php +++ b/core/modules/filter/src/Tests/Migrate/d7/MigrateFilterFormatTest.php @@ -71,6 +71,11 @@ public function testFilterFormat() { $this->assertIdentical('