public function MenuLinkLocalized::prepareRow in Drupal 9
Adds additional data to the row.
Parameters
\Drupal\migrate\Row $row: The row object.
Return value
bool FALSE if this row needs to be skipped.
Overrides MenuLink::prepareRow
File
- core/
modules/ menu_link_content/ src/ Plugin/ migrate/ source/ d7/ MenuLinkLocalized.php, line 43
Class
- MenuLinkLocalized
- Gets localized menu link translations from source database.
Namespace
Drupal\menu_link_content\Plugin\migrate\source\d7Code
public function prepareRow(Row $row) {
$row
->setSourceProperty('skip_source_translation', TRUE);
// Get the mlid for the source menu_link.
$source_mlid = $this
->select('menu_links', 'ml')
->fields('ml', [
'mlid',
])
->condition('i18n_tsid', $row
->getSourceProperty('i18n_tsid'))
->orderBy('mlid')
->range(0, 1)
->execute()
->fetchField();
if ($source_mlid == $row
->getSourceProperty('mlid')) {
$row
->setSourceProperty('skip_source_translation', FALSE);
}
$row
->setSourceProperty('mlid', $source_mlid);
return parent::prepareRow($row);
}