Saving the colour theme in the theme settings creates an error.

Created on 2 February 2024, 10 months ago
Updated 11 September 2024, 2 months ago

Problem/Motivation

Saving the color theme in the theme settings gives an error with Drupal 10

Steps to reproduce

Change the color theme and save it.
The php error is:
ArgumentCountError: Too few arguments
"CssOptimizer() needs exactly 1 parameter in constructor at line 133 of color_submit.php"

Error is specific for Drual 10.

Proposed resolution

Change line 133 from
$css_optimizer = new CssOptimizer(); to
$css_optimizer = new CssOptimizer(\Drupal::service('file_url_generator'));.

Remaining tasks

Review, merge and release

User interface changes

NA

API changes

NA

Data model changes

NA

🐛 Bug report
Status

Active

Version

5.2

Component

Theme Settings

Created by

🇧🇪Belgium ericvl

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ericvl
  • I created the attached patch based on the report but haven't tested it myself.

  • First commit to issue fork.
  • 🇮🇳India himanshu_jhaloya Indore

    Update the patch. please Review

  • 🇺🇸United States wmfinck

    Im am still having this problem.

    Directory permissions are okay, in a subtheme which is newly generated. PHP max_input_vars = 10000

    Brand new Drupal 10 install. Don't know where else to check.

  • 🇧🇪Belgium ericvl

    I think I found a solution for this issue some months ago:

    In the file at_core/forms/color/color_submit.php change the line 98 from

    $paths['source'] = \Drupal::service('extension.list.theme')->getPath($theme); to
    $paths['source'] = \Drupal::service('extension.list.theme')->getPath($theme) . '/';

    I don't know if it will solve your problem but it solved mine.
    Good luck

Production build 0.71.5 2024