Problem/Motivation

Site running AT 8.1.0.

Error: Cannot use object of type Drupal\Core\Layout\LayoutDefinition as array in _at_core_layout_plugin_attributes() (line 1613 of themes/contrib/adaptivetheme/at_core/at_core.theme).

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nedjo created an issue. See original summary.

nedjo’s picture

justkristin’s picture

That bit of code is in at_core/includes/misc.inc in my version. I did the change there, but am still getting the error and a blank site except for "The website encountered an unexpected error. Please try again later." in the browser, and in the apache log:
[Wed May 10 20:17:31.447726 2017] [:error] [pid 11262] [client 199.106.195.8:60523] Error: Cannot use object of type Drupal\\Core\\Layout\\LayoutDefinition as array in /var/www/oursite.org/htdocs/themes/contrib/adaptivetheme/at_core/includes/misc.inc on line 106 #0 /var/www/oursite.org/htdocs/themes/contrib/adaptivetheme/at_core/includes/preprocess.inc(928): _at_core_layout_plugin_attributes(Array)\n#1 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/Theme/ThemeManager.php(287): at_core_preprocess_at_layout(Array, 'ds_1col', Array)\n#2 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/Render/Renderer.php(435): Drupal\\Core\\Theme\\ThemeManager->render('ds_1col', Array)\n#3 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\\Core\\Render\\Renderer->doRender(Array, false)\n#4 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/Template/TwigExtension.php(490): Drupal\\Core\\Render\\Renderer->render(Array)\n#5 /var/www/oursite.org/htdocs/vendor/twig/twig/lib/Twig/Environment.php(462) : eval()'d code(43): Drupal\\Core\\Template\\TwigExtension->escapeFilter(Object(Drupal\\Core\\Template\\TwigEnvironment), Array, 'html', NULL, true)\n#6 /var/www/oursite.org/htdocs/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_186b9b7784943b1cb66dfc04a8b253430787088f9663b1bc2cba32f37c47f1d8->doDisplay(Array, Array)\n#7 /var/www/oursite.org/htdocs/vendor/twig/twig/lib/Twig/Template.php(403): Twig_Template->displayWithErrorHandling(Array, Array)\n#8 /var/www/oursite.org/htdocs/vendor/twig/twig/lib/Twig/Template.php(411): Twig_Template->display(Array)\n#9 /var/www/oursite.org/htdocs/core/themes/engines/twig/twig.engine(64): Twig_Template->render(Array)\n#10 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('modules/ds/temp...', Array)\n#11 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/Render/Renderer.php(435): Drupal\\Core\\Theme\\ThemeManager->render('ds_entity_view', Array)\n#12 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\\Core\\Render\\Renderer->doRender(Array, false)\n#13 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(226): Drupal\\Core\\Render\\Renderer->render(Array, false)\n#14 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/Render/Renderer.php(574): Drupal\\Core\\Render\\MainContent\\HtmlRenderer->Drupal\\Core\\Render\\MainContent\\{closure}()\n#15 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(227): Drupal\\Core\\Render\\Renderer->executeInRenderContext(Object(Drupal\\Core\\Render\\RenderContext), Object(Closure))\n#16 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(117): Drupal\\Core\\Render\\MainContent\\HtmlRenderer->prepare(Array, Object(Symfony\\Component\\HttpFoundation\\Request), Object(Drupal\\Core\\Routing\\CurrentRouteMatch))\n#17 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\\Core\\Render\\MainContent\\HtmlRenderer->renderResponse(Array, Object(Symfony\\Component\\HttpFoundation\\Request), Object(Drupal\\Core\\Routing\\CurrentRouteMatch))\n#18 /var/www/oursite.org/htdocs/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): Drupal\\Core\\EventSubscriber\\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\\Component\\EventDispatcher\\ContainerAwareEventDispatcher))\n#19 /var/www/oursite.org/htdocs/vendor/symfony/http-kernel/HttpKernel.php(149): Drupal\\Component\\EventDispatcher\\ContainerAwareEventDispatcher->dispatch('kernel.view', Object(Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent))\n#20 /var/www/oursite.org/htdocs/vendor/symfony/http-kernel/HttpKernel.php(64): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object(Symfony\\Component\\HttpFoundation\\Request), 1)\n#21 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#22 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\\Core\\StackMiddleware\\Session->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#23 /var/www/oursite.org/htdocs/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\\Core\\StackMiddleware\\KernelPreHandle->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#24 /var/www/oursite.org/htdocs/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\\page_cache\\StackMiddleware\\PageCache->pass(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#25 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\\page_cache\\StackMiddleware\\PageCache->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#26 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#27 /var/www/oursite.org/htdocs/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\\Core\\StackMiddleware\\NegotiationMiddleware->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#28 /var/www/oursite.org/htdocs/core/lib/Drupal/Core/DrupalKernel.php(656): Stack\\StackedHttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#29 /var/www/oursite.org/htdocs/index.php(19): Drupal\\Core\\DrupalKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#30 {main}

Help?

IamDanish’s picture

If the broken module is crashing Drupal site then simply delete module's folder
and
run update script through this URL
http://your-domain.com/update.php

and
Rebuild cache through this URL
http://your-domain.com/core/rebuild.php

justkristin’s picture

IamDanish -

Thank you for the suggestion, but the new module is part of core and the old/deprecated module is required by Adaptive Theme. I don't feel comfortable deleting part of core, especially to assist a module that should be being phased out... no?

nedjo’s picture

@justkristin

That bit of code is in at_core/includes/misc.inc in my version

What version are you using?

justkristin’s picture

I have a child theme that uses an AT base of at_core (8.x-2.0)

nedjo’s picture

I have a child theme that uses an AT base of at_core

What version of AT was that child theme originally written for?

nedjo’s picture

Status: Active » Needs review
Jeff Burnz’s picture

Assigned: Unassigned » Jeff Burnz
nedjo’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
FileSize
596 bytes

Here's a patch for the same issue in the 8.x-2.x branch.

  • Jeff Burnz committed f8e134d on 8.x-2.x authored by nedjo
    Issue #2876818 by nedjo: Cannot use object of type Drupal\Core\Layout\...
Pegasus360’s picture

Nedjo,
Thanks for the work on this theme and the current associated headache.
I went thru the layout plugin change with a site a few months ago and don't want a repeat.
I am building a high content site and am trying to decide between bootstrap (my go to theme)
and adaptivetheme (Never tried it)
I use composer for updates and install patches manually via patch < file.patch
With the AT dev version loaded in the site but not enabled,
I tried to install the patch you developed to work around the layout and keep getting this error.

....
contrib/adaptivetheme]# patch < adaptivetheme-layout-array-2876818-11.patch
can't find file to patch at input line 5
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/at_core/includes/misc.inc b/at_core/includes/misc.inc
|index a349350..e7a772a 100644
|--- a/at_core/includes/misc.inc
|+++ b/at_core/includes/misc.inc
--------------------------
File to patch:

I tried it in the AT-core subdirectory same result
I also tried it with the main non dev release with the same result.
Not sure if the patch is missing a piece or what??

Thoughts.

Pegasus360’s picture

After care:
Following the comments from:
https://www.drupal.org/node/2856162#comment-12115322 #33

hence the patch above trial.

Then reading Jeff's comment that it should work (without the patch?) -

loaded the theme and the at tools via composer require drupal/adaptivetheme and composer require drupal/at_tools
the result requires the layout plugin to enable at tools

loaded the specific dev version of both composer require "drupal/adaptivetheme:2.x-dev" and composer "drupal/at_tools:2.x-dev"
this install does not require the layout plugin to be enabled.

So therefore no patch required??
but this is a fresh install. I'll see if there is a catch or trip.

  • Jeff Burnz committed f8e134d on 8.x-3.x authored by nedjo
    Issue #2876818 by nedjo: Cannot use object of type Drupal\Core\Layout\...
Jeff Burnz’s picture

Status: Needs review » Fixed

#14 the patch is in the 8.x-2.x adn 8.x-3.x branches, so as long as your using a dev etc no need to apply the patch.

nedjo’s picture

Version: 8.x-2.x-dev » 8.x-1.x-dev
Status: Fixed » Needs review

@Jeff Burnz

Thanks for applying this.

The first patch I submitted, #2, is for the 8.x-1.x branch, which I think still needs to be fixed, so setting back to needs review.

  • Jeff Burnz committed 62ccc47 on 8.x-1.x authored by nedjo
    Issue #2876818 by nedjo, Jeff Burnz: Cannot use object of type Drupal\...
Jeff Burnz’s picture

Status: Needs review » Fixed

Cheers Nedjo, much appreciated!

Status: Fixed » Closed (fixed)

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

AlexJ’s picture

Updating D8.4.6 to D8.5.0 - AdaptiveTheme 8.x-1.0 - AT Tools 8.x-1.1 - Display Suite 8.x-3.1.

This commit, 62ccc47, helped me but got this error while running the update.php, but the site was working;

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /update.php/start?id=2686&op=do_nojs&op=do
StatusText: parsererror
ResponseText: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "ds_entity:node" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 52 of /home/theplantgf/theplantmedicineschool.com/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

Tried it on an update from 8.4.6 to 8.5.1 and got this error and the site was white;

The website encountered an unexpected error. Please try again later.Drupal\Component\Plugin\Exception\PluginNotFoundException: The "file_uri" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 52 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

I will do some more work on this next week and see what I can find.

AlexJ’s picture

Updated from D8.4.8 to D8.5.3 - AdaptiveTheme 8.x-1.0 - AT Tools 8.x-1.1 - Display Suite 8.x-3.1.

All working now, thanks to the commit 62ccc47 after an error with an older version of Redirect and a reinstall of that module.

But when I turn on 7.2 PHP I get errors on the redirects on some pages and it won't display properly... work for another day. Thanks.