function Color::prepareRow

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()

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);
}

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