Issue #2562089 by phenaproxima: d7_field_formatter_settings migration does not handle empty settings
parent
87425f3185
commit
1ce074c499
|
@ -62,7 +62,10 @@ process:
|
|||
-
|
||||
plugin: skip_on_empty
|
||||
method: row
|
||||
"options/settings": settings
|
||||
"options/settings":
|
||||
plugin: default_value
|
||||
source: settings
|
||||
default_value: []
|
||||
"options/third_party_settings": 'constants/third_party_settings'
|
||||
destination:
|
||||
plugin: component_entity_display
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
namespace Drupal\field\Tests\Migrate\d7;
|
||||
|
||||
use Drupal\comment\Entity\CommentType;
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
|
||||
use Drupal\Core\Entity\Entity\EntityViewDisplay;
|
||||
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
|
||||
|
@ -89,6 +90,63 @@ class MigrateFieldFormatterSettingsTest extends MigrateDrupal7TestBase {
|
|||
'label' => $this->randomMachineName(),
|
||||
])->save();
|
||||
|
||||
// Give one unfortunate field instance invalid display settings to ensure
|
||||
// that the migration provides an empty array as a default (thus avoiding
|
||||
// an "unsupported operand types" fatal).
|
||||
Database::getConnection('default', 'migrate')
|
||||
->update('field_config_instance')
|
||||
->fields(array(
|
||||
'data' => serialize(array (
|
||||
'label' => 'Body',
|
||||
'widget' =>
|
||||
array (
|
||||
'type' => 'text_textarea_with_summary',
|
||||
'settings' =>
|
||||
array (
|
||||
'rows' => 20,
|
||||
'summary_rows' => 5,
|
||||
),
|
||||
'weight' => -4,
|
||||
'module' => 'text',
|
||||
),
|
||||
'settings' =>
|
||||
array (
|
||||
'display_summary' => true,
|
||||
'text_processing' => 1,
|
||||
'user_register_form' => false,
|
||||
),
|
||||
'display' =>
|
||||
array (
|
||||
'default' =>
|
||||
array (
|
||||
'label' => 'hidden',
|
||||
'type' => 'text_default',
|
||||
'settings' =>
|
||||
array (
|
||||
),
|
||||
'module' => 'text',
|
||||
'weight' => 0,
|
||||
),
|
||||
'teaser' =>
|
||||
array (
|
||||
'label' => 'hidden',
|
||||
'type' => 'text_summary_or_trimmed',
|
||||
// settings is always expected to be an array. Making it NULL
|
||||
// causes a fatal.
|
||||
'settings' => NULL,
|
||||
'module' => 'text',
|
||||
'weight' => 0,
|
||||
),
|
||||
),
|
||||
'required' => false,
|
||||
'description' => '',
|
||||
)),
|
||||
))
|
||||
->condition('entity_type', 'node')
|
||||
->condition('bundle', 'article')
|
||||
->condition('field_name', 'body')
|
||||
->execute();
|
||||
|
||||
$this->executeMigration('d7_field');
|
||||
$this->executeMigration('d7_field_instance');
|
||||
$this->executeMigration('d7_view_modes');
|
||||
|
|
Loading…
Reference in New Issue