0

I am trying to write custom migrations to migrate my Drupal 7 website to Drupal 8. I am currently using Drupal 8.7.10 and Drupal 7.61 for a copy of the production website.

I have tried to migrate description from drupal 7 source and set format as "full_html" for drupal 8.

I have read a lot of sources, for example Migrating input formats causes errors

I have used this code for migration

description/value: description
description/format: format2

and for process plugin

public function prepareRow(Row $row) {
  $row->setSourceProperty('format2', 'full_html');
}

but format didn`t saved for empty description.

How to save the format if the description is not filled?

1 Answer 1

1

The field is empty so it'll get a format set from the configured default when someone enters a description. If there's no value it doesn't need a format, because the format is purely there to say how the value should be displayed.

In theory a value of an empty string with a format attached might give a different result to a null value (the empty string might be wrapped in <p> tags for example) but this will not usually matter in practice.

So the migration is doing what is expected, by not creating an entry for an empty field value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.