Once the module is activated, The next message is printed in all pages:

Error: Call to a member function removeClass() on array in toolbar_anti_flicker_preprocess_html() (line 47 of modules/contrib/toolbar_anti_flicker/toolbar_anti_flicker.module).
toolbar_anti_flicker_preprocess_html(Array, 'html', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 437)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array) (Line: 147)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 148)
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('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 67)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
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: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

I get the module via composer.

Comments

dogamboar created an issue. See original summary.

dogamboar’s picture

Issue summary: View changes
droplet’s picture

What's your Drupal version and theme

dogamboar’s picture

Drupal version 8.7.2
Theme Radix 8.x-3.1

julianvj’s picture

This issue is related to this one from core toolbar_preprocess_html() converts attributes from array to Attribute object

I think that instead of checking Drupal version number you can check if ['attributes']['class'] is an array
Patch attached with this approach.

droplet’s picture

Status: Active » Needs work
+++ b/toolbar_anti_flicker.module
@@ -54,7 +54,7 @@ function toolbar_anti_flicker_preprocess_html(&$variables) {
-  elseif (version_compare(\DRUPAL::VERSION, 8.4, '>')) {
+  elseif (!is_array($variables['attributes']['class'])) {
     $variables['attributes']->removeClass('toolbar-tray-open');

https://www.drupal.org/project/drupal/issues/2917653#comment-12490326
https://www.drupal.org/project/drupal/issues/2917653#comment-12527156

Both are a valid code.
It's going to remove the class, we need to enhance it.

  • droplet committed 8064057 on 8.x-3.x
    git commit -m 'Issue #3058197 by JulianVJ, droplet: Fix access to...
droplet’s picture

Version: 8.x-2.x-dev » 8.x-3.1
Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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