Problem/Motivation

Error: Cannot use string offset as an array en claro_form_system_modules_alter() (línea 754 de /var/www/html/web/core/themes/claro/claro.theme)
#0 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(449): claro_form_system_modules_alter(Array, Object(Drupal\Core\Form\FormState), 'system_modules')
#1 /var/www/html/web/core/lib/Drupal/Core/Theme/ThemeManager.php(458): Drupal\Core\Theme\ThemeManager->alterForTheme(Object(Drupal\Core\Theme\ActiveTheme), 'form', Array, Object(Drupal\Core\Form\FormState), 'system_modules')
#2 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(837): Drupal\Core\Theme\ThemeManager->alter(Array, Array, Object(Drupal\Core\Form\FormState), 'system_modules')
#3 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(279): Drupal\Core\Form\FormBuilder->prepareForm('system_modules', Array, Object(Drupal\Core\Form\FormState))
#4 /var/www/html/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\system\Form\ModulesListForm), Object(Drupal\Core\Form\FormState))
#5 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#6 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#7 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()

Steps to reproduce

- Install module Themable forms (themable_forms)
- Install theme claro
- Go to https://example.site/admin/modules

Proposed resolution

Add an array_key_exist check before using this key

Issue fork drupal-3203745

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

darienmh created an issue. See original summary.

darienmh’s picture

cilefen’s picture

Priority: Critical » Major
Status: Active » Needs review
Issue tags: -theme, -themable, -Claro

I don't think that this meets the definition of a critical bug—for example, Claro is experimental—so I am moving it to major.

abhijith s’s picture

StatusFileSize
new174 KB
new12.29 KB
new61.57 KB

Applied patch #2 on 9.2.x and it works fine.

Before patch:
before

before_2

After patch:
after

seppe beelprez’s picture

Had the same issue, think it's a duplicate of this one: https://www.drupal.org/project/drupal/issues/3204052#comment-14032889

edmund.dunn’s picture

This worked for me.

gorkagr’s picture

Commit in #6 works for me as well in 9.2.7, with the themable_forms module installed
thnks

chetanbharambe’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new101.15 KB
new292.75 KB

Verified and tested Merge Request !448 (https://git.drupalcode.org/project/drupal/-/merge_requests/448.patch)
Merge Request applied successfully and looks good to me.

Testing Steps:
# Goto: Appearance -> Apply Claro theme
# Goto: Extend -> Install New Module -> Themable Forms
# Try to install it
# Check the results

Expected Results:
# User should be able to install the Themable forms module

Actual Results:
# Currently, the User is able to see errors.

Please refer attached screenshots for the same.
Looks good to me.
Can be a move to RTBC.

alexpott’s picture

Version: 9.1.x-dev » 9.2.x-dev
Priority: Major » Normal
Status: Reviewed & tested by the community » Fixed

Discussed with @lauriii we decided to commit this as an extra safety level around claro's form alter. That said we both agreed that this probably points to issues with the Themable Forms module as it might be making changes that would prove to be incompatible with other themes as well.

Also given Claro is experimental and https://www.drupal.org/project/themable_forms only has a beta release this is not a major bug.

Committed and pushed 2a03fb2c53 to 9.3.x and 5bc445ba77 to 9.2.x. Thanks!

Backported to 9.2.x as this is a low risk bug fix.

  • alexpott committed 2a03fb2 on 9.3.x
    Issue #3203745 by darienmh, Abhijith S, chetanbharambe: Claro theme is...

  • alexpott committed 5bc445b on 9.2.x
    Issue #3203745 by darienmh, Abhijith S, chetanbharambe: Claro theme is...

Status: Fixed » Closed (fixed)

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