function MenuLinkTranslation::prepareRow

Same name in this branch
  1. 10 core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php \Drupal\menu_link_content\Plugin\migrate\source\d6\MenuLinkTranslation::prepareRow()
Same name in other branches
  1. 9 core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php \Drupal\menu_link_content\Plugin\migrate\source\d6\MenuLinkTranslation::prepareRow()
  2. 9 core/modules/menu_link_content/src/Plugin/migrate/source/d7/MenuLinkTranslation.php \Drupal\menu_link_content\Plugin\migrate\source\d7\MenuLinkTranslation::prepareRow()
  3. 8.9.x core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php \Drupal\menu_link_content\Plugin\migrate\source\d6\MenuLinkTranslation::prepareRow()
  4. 11.x core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php \Drupal\menu_link_content\Plugin\migrate\source\d6\MenuLinkTranslation::prepareRow()
  5. 11.x core/modules/menu_link_content/src/Plugin/migrate/source/d7/MenuLinkTranslation.php \Drupal\menu_link_content\Plugin\migrate\source\d7\MenuLinkTranslation::prepareRow()

Overrides MenuLink::prepareRow

File

core/modules/menu_link_content/src/Plugin/migrate/source/d7/MenuLinkTranslation.php, line 48

Class

MenuLinkTranslation
Drupal 7 i18n menu link translations source from database.

Namespace

Drupal\menu_link_content\Plugin\migrate\source\d7

Code

public function prepareRow(Row $row) {
    if (!parent::prepareRow($row)) {
        return FALSE;
    }
    // Put the language on the row as 'language'.
    $row->setSourceProperty('language', $row->getSourceProperty('lt_language'));
    // Save the translation for this property.
    $property_in_row = $row->getSourceProperty('property');
    // Set the i18n string table for use in I18nQueryTrait.
    $this->i18nStringTable = 'i18n_string';
    // Get the translation for the property not already in the row and save it
    // in the row.
    $property_not_in_row = $property_in_row == 'title' ? 'description' : 'title';
    return $this->getPropertyNotInRowTranslation($row, $property_not_in_row, 'mlid', $this->idMap);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.