You are here

public function Color::prepareRow in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/color/src/Plugin/migrate/source/d7/Color.php \Drupal\color\Plugin\migrate\source\d7\Color::prepareRow()

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

File

core/modules/color/src/Plugin/migrate/source/d7/Color.php, line 74

Class

Color
Drupal 7 color source from database.

Namespace

Drupal\color\Plugin\migrate\source\d7

Code

public function prepareRow(Row $row) {
  $themes = $this->themeHandler
    ->listInfo();
  $themes_installed = [];

  /** @var \Drupal\Core\Extension\Extension $theme */
  foreach ($themes as $theme) {
    if ($theme->status) {
      $themes_installed[] = $theme
        ->getName();
    }
  }

  // The name is of the form 'color_theme_variable'.
  $name = explode('_', $row
    ->getSourceProperty('name'));

  // Set theme_installed if this source theme is installed.
  if (in_array($name[1], $themes_installed)) {
    $row
      ->setSourceProperty('theme_installed', TRUE);
  }
  return parent::prepareRow($row);
}