summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2017-04-18 08:13:06 (GMT)
committerAlex Pott2017-04-18 08:13:06 (GMT)
commit631e8d8475dac6cb99f6f8fec9677368dd8a8ce4 (patch)
tree0f17417ad4d8e5f261a8d02db1854640f9806281
parent40d1faf88754c0a625fb44548895a3b4ab8eb0d0 (diff)
Issue #2724903 by rocketeerbkw, gaurav.kapoor, Jo Fitzgerald, phenaproxima: Migrated custom block body field is hidden on form and display
-rw-r--r--core/modules/block_content/migration_templates/block_content_entity_display.yml39
-rw-r--r--core/modules/block_content/migration_templates/block_content_entity_form_display.yml36
-rw-r--r--core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityDisplayTest.php54
-rw-r--r--core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityFormDisplayTest.php54
-rw-r--r--core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php8
5 files changed, 191 insertions, 0 deletions
diff --git a/core/modules/block_content/migration_templates/block_content_entity_display.yml b/core/modules/block_content/migration_templates/block_content_entity_display.yml
new file mode 100644
index 0000000..06a35d7
--- /dev/null
+++ b/core/modules/block_content/migration_templates/block_content_entity_display.yml
@@ -0,0 +1,39 @@
+id: block_content_entity_display
+label: Body field display configuration
+migration_tags:
+ - Drupal 6
+ - Drupal 7
+source:
+ plugin: embedded_data
+ data_rows:
+ -
+ entity_type: block_content
+ bundle: basic
+ view_mode: default
+ field_name: body
+ options:
+ label: hidden
+ ids:
+ entity_type:
+ type: string
+ bundle:
+ type: string
+ view_mode:
+ type: string
+ field_name:
+ type: string
+process:
+ entity_type: entity_type
+ bundle: bundle
+ view_mode: view_mode
+ field_name: field_name
+ options: options
+destination:
+ plugin: component_entity_display
+migration_dependencies:
+ required:
+ - block_content_body_field
+provider:
+ - block_content
+ - migrate_drupal
+
diff --git a/core/modules/block_content/migration_templates/block_content_entity_form_display.yml b/core/modules/block_content/migration_templates/block_content_entity_form_display.yml
new file mode 100644
index 0000000..92b5a10
--- /dev/null
+++ b/core/modules/block_content/migration_templates/block_content_entity_form_display.yml
@@ -0,0 +1,36 @@
+id: block_content_entity_form_display
+label: Body field form display configuration
+migration_tags:
+ - Drupal 6
+ - Drupal 7
+source:
+ plugin: embedded_data
+ data_rows:
+ -
+ entity_type: block_content
+ bundle: basic
+ form_mode: default
+ field_name: body
+ ids:
+ entity_type:
+ type: string
+ bundle:
+ type: string
+ form_mode:
+ type: string
+ field_name:
+ type: string
+process:
+ entity_type: entity_type
+ bundle: bundle
+ form_mode: form_mode
+ field_name: field_name
+destination:
+ plugin: component_entity_form_display
+migration_dependencies:
+ required:
+ - block_content_body_field
+provider:
+ - block_content
+ - migrate_drupal
+
diff --git a/core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityDisplayTest.php b/core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityDisplayTest.php
new file mode 100644
index 0000000..5eb9e41
--- /dev/null
+++ b/core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityDisplayTest.php
@@ -0,0 +1,54 @@
+<?php
+
+namespace Drupal\Tests\block_content\Kernel\Migrate;
+
+use Drupal\Core\Entity\Entity\EntityViewDisplay;
+use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
+
+/**
+ * Tests migration of block content body field display configuration.
+ *
+ * @group block_content
+ */
+class MigrateBlockContentEntityDisplayTest extends MigrateDrupal7TestBase {
+
+ /**
+ * {@inheritdoc}
+ */
+ public static $modules = ['block', 'block_content', 'filter', 'text'];
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function setUp() {
+ parent::setUp();
+ $this->installConfig(static::$modules);
+ $this->executeMigrations([
+ 'block_content_type',
+ 'block_content_body_field',
+ 'block_content_entity_display',
+ ]);
+ }
+
+ /**
+ * Asserts a display entity.
+ *
+ * @param string $id
+ * The entity ID.
+ * @param string $component_id
+ * The ID of the display component.
+ */
+ protected function assertDisplay($id, $component_id) {
+ $component = EntityViewDisplay::load($id)->getComponent($component_id);
+ $this->assertInternalType('array', $component);
+ $this->assertSame('hidden', $component['label']);
+ }
+
+ /**
+ * Tests the migrated display configuration.
+ */
+ public function testMigration() {
+ $this->assertDisplay('block_content.basic.default', 'body');
+ }
+
+}
diff --git a/core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityFormDisplayTest.php b/core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityFormDisplayTest.php
new file mode 100644
index 0000000..84e1fe3
--- /dev/null
+++ b/core/modules/block_content/tests/src/Kernel/Migrate/MigrateBlockContentEntityFormDisplayTest.php
@@ -0,0 +1,54 @@
+<?php
+
+namespace Drupal\Tests\block_content\Kernel\Migrate;
+
+use Drupal\Core\Entity\Entity\EntityFormDisplay;
+use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
+
+/**
+ * Tests migration of block content body field form display configuration.
+ *
+ * @group block_content
+ */
+class MigrateBlockContentEntityFormDisplayTest extends MigrateDrupal7TestBase {
+
+ /**
+ * {@inheritdoc}
+ */
+ public static $modules = ['block', 'block_content', 'filter', 'text'];
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function setUp() {
+ parent::setUp();
+ $this->installConfig(static::$modules);
+ $this->executeMigrations([
+ 'block_content_type',
+ 'block_content_body_field',
+ 'block_content_entity_form_display',
+ ]);
+ }
+
+ /**
+ * Asserts a display entity.
+ *
+ * @param string $id
+ * The entity ID.
+ * @param string $component
+ * The ID of the form component.
+ */
+ protected function assertDisplay($id, $component_id) {
+ $component = EntityFormDisplay::load($id)->getComponent($component_id);
+ $this->assertInternalType('array', $component);
+ $this->assertSame('text_textarea_with_summary', $component['type']);
+ }
+
+ /**
+ * Tests the migrated display configuration.
+ */
+ public function testMigration() {
+ $this->assertDisplay('block_content.basic.default', 'body');
+ }
+
+}
diff --git a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php
index 241b3c7..29b1484 100644
--- a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php
+++ b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php
@@ -70,6 +70,14 @@ class MigrateUpgradeForm extends ConfirmFormBase {
'source_module' => 'block',
'destination_module' => 'block',
],
+ 'block_content_entity_form_display' => [
+ 'source_module' => 'block',
+ 'destination_module' => 'block_content',
+ ],
+ 'block_content_entity_display' => [
+ 'source_module' => 'block',
+ 'destination_module' => 'block_content',
+ ],
'block_content_body_field' => [
'source_module' => 'block',
'destination_module' => 'block_content',