Hi,

how do I set the body_format to filtered_html?
I tried
$this->addFieldMapping('body_format')
->defaultValue('filtered_html');

Comments

mikeryan’s picture

Status: Active » Postponed (maintainer needs more info)

The format is not a node field, it is an attribute of the body field and is passed to the body field through arguments. Try

$this->addFieldMapping('body', 'body_source')
     ->arguments(array('format' => 'filtered_html'));

If that works for you, please mark this issue as fixed.

jospBln’s picture

Status: Postponed (maintainer needs more info) » Fixed

Thanks,

that's it!

$this->addFieldMapping('body', 'HereComesYourSourceData')
->arguments(array('format' => 'filtered_html'));

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

chrisjlock’s picture

You can also set the default format for the import with:

$this->destination = new MigrateDestinationNode('page', array('text_format' => 'full_html'));
solomonson’s picture

Version: 7.x-2.x-dev » 6.x-2.2
Component: Documentation » Code
Category: support » bug
Status: Closed (fixed) » Needs review

This feature did not work in 6.x-2.2. Is it only in the 7x version? When I try it, I get the following error during the import:

strpos() expects parameter 1 to be string, array given
File /var/www/drupal-6.22/modules/node/node.module, line 313
mikeryan’s picture

Category: bug » support
Status: Needs review » Postponed (maintainer needs more info)

It should work - which technique were you using? text_format option on MigrateDestinationNode(), or format argument on the addFieldMapping()? Can you show your MigrateDestinationNode() and your addFieldMapping for the text field?

mikeryan’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

No further info provided.

alex andrascu’s picture

Can confirm this

        $this->addFieldMapping( 'body', 'user_comment' )
        ->arguments( array( 'format' => 'full_html' ) );
        $this->addFieldMapping( 'field_ass_feedback', 'prev_reviewer_comment' )
        ->arguments( array( 'format' => 'full_html' ) );

and drush complains:

File .../modules/node/node.module, line 313
strpos() expects parameter 1 to be string, array given                                                                                            [error]
alex andrascu’s picture