Call to a member function addClass() on array in claro_preprocess_form_element when calling page admin/modules

Created on 27 January 2023, over 1 year ago
Updated 27 December 2023, 6 months ago

Problem/Motivation

When I call mydomain.de//de/admin/modules i get an error message:

Call to a member function addClass() on array in claro_preprocess_form_element() (Zeile 783 in /www/htdocs/web/core/themes/claro/claro.theme).

Steps to reproduce

TBD

Proposed resolution

For the moment i helpted me with comment this line:

$variables['description']['attributes']->addClass('is-disabled');

So i could get activated Open Graph from Meta Tag.

I can not say, if the error comes with core ore an other module.
Until today I installed all modules with composer and activated with drush, so i never tried calling this page before.

TBD proposed solution needs to be cleaned up.

Remaining tasks

Update issue summary
Add tests
Review

User interface changes

NA

API changes

NA

Data model changes

NA

Release notes snippet

NA

🐛 Bug report
Status

Closed: cannot reproduce

Version

10.1

Component
Claro 

Last updated about 6 hours ago

Created by

🇩🇪Germany Lissy

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

  • Issue created by @Lissy
  • Assigned to nivethitha
  • Status changed to Closed: works as designed over 1 year ago
  • 🇮🇳India nivethitha

    I am not get this type of issue on this version. Please check it once again.

  • Status changed to Needs work 7 months ago
  • 🇺🇸United States johnnydarkko

    I'm getting this error, too, and it's quite annoying. I can't do anything unless I hack the `claro.theme` file. Even when the 'Proposed Solution' is done, I'm getting this error that appears to be related, except my error says 'null' instead of 'array':

    Error: Call to a member function addClass() on null in claro_preprocess_links__action_links() (line 1245 of core/themes/claro/claro.theme).
    
    call_user_func_array('claro_preprocess_links__action_links', Array) (Line: 285)
    Drupal\Core\Theme\ThemeManager->render('links__action_links', Array) (Line: 445)
    Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
    Drupal\Core\Render\Renderer->render(Array) (Line: 474)
    Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 194)
    __TwigTemplate_10df5664077d83d1951875e752383543->doDisplay(Array, Array) (Line: 394)
    Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
    Twig\Template->display(Array) (Line: 379)
    Twig\Template->render(Array, Array) (Line: 40)
    Twig\TemplateWrapper->render(Array) (Line: 53)
    twig_render_template('themes/contrib/gin/templates/system/system-themes-page.html.twig', Array) (Line: 372)
    Drupal\Core\Theme\ThemeManager->render('system_themes_page', Array) (Line: 445)
    Drupal\Core\Render\Renderer->doRender(Array) (Line: 458)
    Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
    Drupal\Core\Render\Renderer->render(Array, ) (Line: 238)
    Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 592)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 239)
    Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128)
    Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
    Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
    call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 187)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
    

    I created a patch that checks to see if the `attributes` key exists before invoking `addClass`, but this feels like there's something else that has gone awry...

  • Status changed to Needs review 7 months ago
  • Status changed to Needs work 7 months ago
  • 🇺🇸United States smustgrave

    Added the issue template but there are sections that need to be filled in, mainly steps to reproduce and an agreed solution.

    Will need a test case also.

  • 🇮🇳India sijumpk

    @johnnydarkko, Normally going to /admin/modules (as said in the issue summary) is not making any errors. Maybe some custom/contributed module's links are generating the problem. Try to recreate the problem by disabling all non-core installed modules.

  • Status changed to Postponed: needs info 7 months ago
  • 🇮🇳India Prashant.c Dharamshala

    Attempted to replicate the issue on versions 10.1.x and 11.0.x by introducing the German language and exploring various pages, including /admin/modules. However, I was unable to encounter the error. @nivethitha, it would be appreciated if you could provide instructions on how to reproduce this issue. Thank you.

  • 🇮🇳India Prashant.c Dharamshala
  • Issue was unassigned.
  • 🇮🇳India AkshayAdhav Pune, India 🇮🇳
  • 🇺🇸United States johnnydarkko

    Turns out the issue was due to some bad custom code in a custom module overriding link text in an implementation of hook_preprocess_links for a link that doesn't exist in the variables array of the admin pages that were whitescreening for me. So, the case I described earlier isn't a valid report, but I'll leave this all here just in case it helps someone else making the same bonehead mistake :)

  • Status changed to Closed: cannot reproduce 6 months ago
  • 🇺🇸United States smustgrave

    Not deleting the issue just moving to a different bucket.

Production build 0.69.0 2024