Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. BlockTheme.php

function BlockTheme::transform

Overrides ProcessPluginBase::transform

File

core/modules/block/src/Plugin/migrate/process/BlockTheme.php, line 64

Class

BlockTheme

Namespace

Drupal\block\Plugin\migrate\process

Code

public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    [
        $theme,
        $default_theme,
        $admin_theme,
    ] = $value;
    // If the source theme exists on the destination, we're good.
    if (isset($this->themes[$theme])) {
        return $theme;
    }
    // If the source block is assigned to a region in the source default theme,
    // then assign it to the destination default theme.
    if (strtolower($theme) == strtolower($default_theme)) {
        return $this->themeConfig
            ->get('default');
    }
    // If the source block is assigned to a region in the source admin theme,
    // then assign it to the destination admin theme.
    if ($admin_theme && strtolower($theme) == strtolower($admin_theme)) {
        return $this->themeConfig
            ->get('admin');
    }
    // We couldn't map it to a D8 theme so just return the incoming theme.
    return $theme;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal