function BlockCustomTranslation::prepareRow

Same name in other branches
  1. 8.9.x core/modules/block_content/src/Plugin/migrate/source/d7/BlockCustomTranslation.php \Drupal\block_content\Plugin\migrate\source\d7\BlockCustomTranslation::prepareRow()
  2. 10 core/modules/block_content/src/Plugin/migrate/source/d7/BlockCustomTranslation.php \Drupal\block_content\Plugin\migrate\source\d7\BlockCustomTranslation::prepareRow()
  3. 11.x core/modules/block_content/src/Plugin/migrate/source/d7/BlockCustomTranslation.php \Drupal\block_content\Plugin\migrate\source\d7\BlockCustomTranslation::prepareRow()

Overrides SourcePluginBase::prepareRow

File

core/modules/block_content/src/Plugin/migrate/source/d7/BlockCustomTranslation.php, line 63

Class

BlockCustomTranslation
Drupal 7 i18n custom block translations source from database.

Namespace

Drupal\block_content\Plugin\migrate\source\d7

Code

public function prepareRow(Row $row) {
    if (!parent::prepareRow($row)) {
        return FALSE;
    }
    // Set the i18n string table for use in I18nQueryTrait.
    $this->i18nStringTable = static::I18N_STRING_TABLE;
    // Save the translation for this property.
    $property_in_row = $row->getSourceProperty('property');
    // 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' ? 'body' : 'title';
    return $this->getPropertyNotInRowTranslation($row, $property_not_in_row, 'bid', $this->idMap);
}

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