You are here

public function PathRedirect::prepareRow in Redirect 8

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 SourcePluginBase::prepareRow

File

src/Plugin/migrate/source/d7/PathRedirect.php, line 36
Contains \Drupal\redirect\Plugin\migrate\source\d7\PathRedirect.

Class

PathRedirect
Drupal 7 path redirect source from database.

Namespace

Drupal\redirect\Plugin\migrate\source\d7

Code

public function prepareRow(Row $row) {
  static $default_status_code;
  if (!isset($default_status_code)) {
    $default_status_code = unserialize($this
      ->getDatabase()
      ->select('variable', 'v')
      ->fields('v', [
      'value',
    ])
      ->condition('name', 'redirect_default_status_code')
      ->execute()
      ->fetchField());
  }
  $current_status_code = $row
    ->getSourceProperty('status_code');
  $status_code = $current_status_code != 0 ? $current_status_code : $default_status_code;
  $row
    ->setSourceProperty('status_code', $status_code);
  return parent::prepareRow($row);
}