While working on #2500495: Upgrade path for Color 7.x I found that there isn't an upgrade path for theme settings so creating this issue. The variables are theme_themename_settings, theme_default and admin_theme. And on a first look it appears that the variables migrate to these configurations as follows.

theme_themename_settings ==> themename.settings
theme_default ==> system.theme.global
admin_theme ==> system.theme.global

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quietone created an issue. See original summary.

quietone’s picture

This will migrate the default and admin theme settings. Although posted here, for now, it probably can be included in the patch in the parent issue.

id: d7_theme
label: D7 admin and default theme
migration_tags:
  - Drupal 7
source:
  plugin: variable
  variables:
    - admin_theme
    - theme_default
process:
  admin: admin_theme
  default: theme_default
destination:
  plugin: config
  config_name: system.theme
quietone’s picture

Status: Active » Needs review
FileSize
10.86 KB

This patch isn't complete, there aren't any assertions in the migration test. That's because it isn't writing data to the destination configuration due to a 'no schema' error.

/2620364No schema for seven.settings (/opt/sites/md82/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php:91)

It is true that there isn't a schema for seven.settings, but theme settings form writes to a configuration with that name.

And the process plugin is named Explode and not ThemeSettings because it only does an explode and it can also be used in the Color migration. But I left it in the system module since I'm not sure if it should go into migrate or not.

Status: Needs review » Needs work

The last submitted patch, 3: 2620364-3.patch, failed testing.

quietone’s picture

Status: Needs work » Needs review
FileSize
18.77 KB
12.03 KB

Just needed to install some themes. Added the insertions and some cleanup as well.

Status: Needs review » Needs work

The last submitted patch, 5: 2620364-5.patch, failed testing.

quietone’s picture

Status: Needs work » Postponed
FileSize
4.74 KB
14.66 KB

Modified to use the explode process plugin from #2575101: Add an explode/separator process plugin.

Postponing on that issue.

quietone’s picture

Status: Postponed » Needs review

#2575101: Add an explode/separator process plugin is in, so no longer postponed.
Changed to needs review for the testbot.

Status: Needs review » Needs work

The last submitted patch, 7: 2620364-7.patch, failed testing.

quietone’s picture

Status: Needs work » Needs review
FileSize
15.59 KB

Now that explode returns multiple true, extract and get try to iterate over an array in Processrow. To avoid that handle_multiples is set to True in each, this may be wrong, but I want to see what errors are found.

Status: Needs review » Needs work

The last submitted patch, 10: 2620364-10.patch, failed testing.

quietone’s picture

Status: Needs work » Needs review
FileSize
15.59 KB

Bad patch, I got interrupted and messed it up.
Again.

quietone’s picture

Status: Needs review » Postponed

As advised by chx, created new issues and postponing this.

Postponed on #2675164: Pipeline using explode and concat fails and #2675156: Pipeline using explode and extract fails.

quietone’s picture

Issue tags: +migrate-d7-d8

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mikeryan’s picture

Assigned: Unassigned » quietone
Status: Postponed » Needs work
Issue tags: +Needs reroll
quietone’s picture

Assigned: quietone » Unassigned
Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
15.9 KB

Rerolled. Moved source plugin test to MigrateSqlSourceTestBase, made the process of getting the configuration name a two step process, the same as for the color migration.

jofitz’s picture

Status: Needs review » Needs work
+++ b/core/modules/system/src/Plugin/migrate/destination/d7/ThemeSettings.php
@@ -0,0 +1,92 @@
+ * Persist theme settings tohe config system.

Typo? Should this say "to the"?

Otherwise this looks great to me - just one small step away from RTBC.

amoebanath’s picture

Status: Needs work » Needs review
FileSize
5.31 KB

Patch :)

yogeshmpawar’s picture

@amoebanath - you have added wrong patch, I have added a correct patch :)

jofitz’s picture

Status: Needs review » Reviewed & tested by the community

Great, thanks both.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 22: variable_to_config-2620364-22.patch, failed testing.

jofitz’s picture

Status: Needs work » Reviewed & tested by the community

Retests passed successfully - back to RTBC.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 22: variable_to_config-2620364-22.patch, failed testing.

jofitz’s picture

Status: Needs work » Reviewed & tested by the community

Tests are green - back to RTBC.

yogeshmpawar’s picture

Any Updates on this issue ?

catch’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/system/src/Plugin/migrate/destination/d7/ThemeSettings.php
@@ -0,0 +1,92 @@
+   * Constructs a BlockedIP object.

This definitely doesn't construct a BlockedIP object. c&p error?

+++ b/core/modules/system/tests/src/Kernel/Plugin/migrate/source/d7/ThemeSettingsTest.php
@@ -0,0 +1,79 @@
+
+    // The expected results are identical to the source data.
+    $tests[0]['expected_data'] = [

If the expected results are identical to the source data, why not do $tests['0]['expected_data'] = $tests[0]['source_data']['variable']; instead of duplicating the array manually?

jofitz’s picture

Status: Needs work » Needs review
FileSize
1.95 KB
15.29 KB

Adjustments suggested in #29.

Status: Needs review » Needs work

The last submitted patch, 30: 2620364-30.patch, failed testing.

jofitz’s picture

Status: Needs work » Needs review
FileSize
3.13 KB
2.15 KB
15.31 KB

Aha, apparently the source data and expected results are nearly identical.

Adjusted the code to make the similarities/differences clear (and actually pass the test this time!)

phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. Back to RTBC.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Baltimore2017

Mostly just found minor things.

  1. +++ b/core/modules/system/migration_templates/d7_theme_settings.yml
    @@ -0,0 +1,44 @@
    +  # build the configuration name from the variable name, i.e.
    +  # theme_bartik_settings becomes bartik.settings
    

    Make this a sentence IMHO.

  2. +++ b/core/modules/system/migration_templates/d7_theme_settings.yml
    @@ -0,0 +1,44 @@
    +# Ignore settings not present in Drupal 8
    

    Comment standards need a . at the end IMHO.

  3. +++ b/core/modules/system/src/Plugin/migrate/destination/d7/ThemeSettings.php
    @@ -0,0 +1,92 @@
    +  /**
    +   * {@inheritdoc}
    +   */
    +  public function fields(MigrationInterface $migration = NULL) {
    +  }
    

    I guess we need this for the interface, can we document why we don't implement it?

  4. +++ b/core/modules/system/src/Plugin/migrate/source/d7/ThemeSettings.php
    @@ -0,0 +1,48 @@
    +class ThemeSettings extends VariableMultiRow {
    +  /**
    +   * {@inheritdoc}
    +   */
    +  protected $variables;
    

    Hm, if its inheritdoc, why are we defining it again? (If we need to, we need a newline above).

heddn’s picture

Issue tags: +Novice

Tagging for the response to #34.

bburg’s picture

Assigned: Unassigned » bburg
bburg’s picture

Looks like the {@inheritdoc} in #3 is referring to the method defined in the MigrateDestinationInterface interface. I'm no idea why the method is just a stub. Is it because we are migrating the equivalent of Drupal variables, and there aren't any fields? Should it return an empty array?

I don't see where $variables in #4 is defined or used. Where did this come from?

bburg’s picture

Patch for 1 and 2 only for #34.

phenaproxima’s picture

I looked into #34.3 and #34.4:

  • Let's make ThemeSettings::fields() return an empty array for interface conformance, and add an inline comment (not in the doc block) which says something like "Theme settings vary by theme, so no specific fields are defined."
  • ThemeSettings::$variables is never used. Let's just remove it entirely.

Once these two points are done, I think this is RTBC.

bburg’s picture

Status: Needs work » Needs review
FileSize
1.05 KB
15.34 KB

phenaproxima's suggestions applied. I used your comment for #34.3 verbatim.

I realized tha I was working off the 8.4.x branch. Everything seemed to apply cleanly though, we'll see if the tests complete.

phenaproxima’s picture

Status: Needs review » Needs work
+++ b/core/modules/system/src/Plugin/migrate/destination/d7/ThemeSettings.php
@@ -87,6 +87,8 @@ public function getIds() {
+    return array();

One small thing -- the coding standards now require us to use short array syntax in core. So this should be [], not array().

Other than that, this looks perfect.

bburg’s picture

Ah, thanks for the catch. Updated patch included.

bburg’s picture

Status: Needs work » Needs review
phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Werd up. #40 passed Drupal CI, so I am pre-RTBCing #42 since it was just a syntax change. Nice one.

  • catch committed 80445be on 8.4.x
    Issue #2620364 by quietone, bburg, Jo Fitzgerald, Yogesh Pawar,...

  • catch committed e5199cf on 8.3.x
    Issue #2620364 by quietone, bburg, Jo Fitzgerald, Yogesh Pawar,...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.4.x and cherry-picked to 8.3.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.