Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
How do you access a subfield in the prepareRow function?
I have a link field to import from D6, and I want to change the link titles. If I print out the $row object, I can see the link has three entries, field_websites and field_websites:title and field_websites:attributes
public function prepareRow($row) {
if (parent::prepareRow($row) === FALSE) {
return FALSE;
}
//this works
$row->field_websites = 'something else';
//this does not even run
$row->field_websites:title = 'something else';
//this does not map properly
$row->field_websites_title = 'something else';
}
Thanks in advance
Comments
Comment #2
jonathan_hunt CreditAttribution: jonathan_hunt commentedTry
$row->{'field_websites:title'}
, see https://secure.php.net/manual/en/language.oop5.properties.php#117617