(Noticed this while working on #1332580: Clean up API docs for color module.)

In color.module, we find this form_alter implementation:

/**
 * Implements hook_form_FORM_ID_alter().
 */
function color_form_system_themes_alter(&$form, &$form_state) {
  _color_theme_select_form_alter($form, $form_state);
}

This is the only place where _color_theme_select_form_alter() is called, so we probably just should move its function body here in any case.

More importantly, there is no form with the ID "system_themes" in D8 or D7---and even though the themes page used to be form in D6, there wasn't a form with the ID "system_themes" in D6 either (though there was one with the ID "system_themes_form").

Which means that, at least since D6, this implementation has altered a form that does not exists---viz. has not done anything. Given that no-one has missed what it is trying to do, it looks like this function (an _color_theme_select_form_alter()) can just be ripped out.

CommentFileSizeAuthor
#1 1337198.patch1.15 KBbleen
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bleen’s picture

Status: Active » Needs review
FileSize
1.15 KB

So the intent of this code was to change the screenshot that appears on the Theme selection form to reflect the color settings for the theme in question:
Appearance | d8
However, in D6 this code relied on the fact that the color module created a screenshot that could be used for the preview. In D7 there is no longer an image created so I think it is safe to remove this code.

amateescu’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs backport to D7

Research checks out and the patch looks good to me. Clean-up++ :)

sven.lauer’s picture

Issue tags: +Needs backport to D6

Tagging also for backport to D6, since, as the OP indicates, it seems that even in D6, this does not do what it is supposed to. So once this gets in for (D8 and possibly) D7, we should figure out what to do in D6.

Dries’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed to 8.x. Moving to 7.x so we can consider backporting this. Technically, it would be an API change, although not a big one.

sun’s picture

Version: 7.x-dev » 8.x-dev
Status: Patch (to be ported) » Needs work

Apparently, this is still supposed to work:

/core/modules/color> grep -R 'screenshot' ./*
./color.module:    variable_del('color_' . $theme . '_screenshot');
./color.module:    if ($file == 'screenshot.png') {
./color.module:      variable_set('color_' . $theme . '_screenshot', $image);
sven.lauer’s picture

Alas, but it doesn't work, even in D7. Since no-one has cried foul over this (at least I can find nothing in the issue queue), the question is whether this is actually "supposed to work".

Basically we have to decide:

(a) That this functionality has been implicitly removed, so we simply should also remove the code that generates the colored screenshots.
or
(b) Bring back the form alter function and make it work.

sven.lauer’s picture

P. S. Some cursory testing seems to confirm that this also does not work in current D6 (so, did it ever?), which is not surprising, given the wrong FORM_ID mentioned in the OP.

sun’s picture

Can you try to make it work? If it's only the $form_id and/or form structure...?

That said, you might need to test in D7/D6 with Garland, as it's possible (and reasonable) that newer themes don't support... err... don't even know of this capability.

I'm undecided myself, for

1) this is quite a super-advanced feature of Color module, and I'm surprised myself that Color module actually contains code for it, which is supposed work (and most likely did at some point). As an end-user (and Color module is designed for the end-user, right?), I guess I'd appreciate it if the screenshot would show the actual colors of the theme.

but OTOH, there's also

2) based on a super-quick glance on the code after grepping, there seems to be quite some (also: untested) code involved for this dirty little fancy feature. Perhaps, but not sure, that's too much.

Now, I won't state that I'd be in favor of 1) on the grounds of exposing what is actually possible in terms of theme customization overrides, but I didn't state that, did I?

sven.lauer’s picture

I did test with Garland, as I suspect(ed) that, at some point in time _color_theme_select_form_alter() was intended to be called by the theme in its own form_alter implementation (on the model of things like _color_html_alter()), until at some point someone realized that you can do this in a single form_alter in color module. Hence I thought that maybe Garland still does this "manually", but it does not seem to.

It should not be too hard to make this work, but I kind of agree with your (2)---color_scheme_form_submit() could be simplified quite a bit if we decide to get rid of this nice-to-have feature that no-one seems to have missed in the longish time since its defunct.

(I just poked around to see how long this has been defunct: In D6, the form 'system_themes' was renamed to 'system_themes_form' in http://drupalcode.org/project/drupal.git/commit/5bbbf10ba84042b8576d6757... in April 2007. So this has been broken four almost five years.)

sven.lauer’s picture

Do note that this also means that the screenshot-generating code has not had a visible effect in almost five years. So just fixing the form alter code without thoroughly testing the screenshot-generating code would be a bad idea. For all we know, the screenshot-generation make be breaking in all kinds of cases.

markhalliwell’s picture

The following is still in D8:

grep -R 'screenshot' ./*
./color.install:    if (update_variable_get('color_' . $theme_key . '_screenshot')) {
./color.install:      $config->set('screenshot', update_variable_get('color_' . $theme_key . '_screenshot'));
./color.module:    if ($file == 'screenshot.png') {
./color.module:        ->set('screenshot', $image)

We should just remove this, really.

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.

  • Dries committed 6165e9e on 8.3.x
    - Patch #1337198 by bleen18: remove useless form_alter() implementation...

  • Dries committed 6165e9e on 8.3.x
    - Patch #1337198 by bleen18: remove useless form_alter() implementation...

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.

  • Dries committed 6165e9e on 8.4.x
    - Patch #1337198 by bleen18: remove useless form_alter() implementation...

  • Dries committed 6165e9e on 8.4.x
    - Patch #1337198 by bleen18: remove useless form_alter() implementation...

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.

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

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.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.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.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.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.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.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

  • Dries committed 6165e9e on 9.1.x
    - Patch #1337198 by bleen18: remove useless form_alter() implementation...

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

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

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev
quietone’s picture

Version: 9.3.x-dev » 8.0.x-dev
Issue summary: View changes
Status: Needs work » Fixed

This issue was committed to Drupal 7 and Drupal 8. It was then reopened when it was noticed that functionality was lost, #6. Instead of this old issue lingering let's close it and have a new issue to decide what to do next. The new issue is #3270443: Screenshot no longer shows the acutal color.

Marking fixed in Drupal 8.0

Status: Fixed » Closed (fixed)

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