Closed (fixed)
Project:
Configurable Help
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Apr 2017 at 21:49 UTC
Updated:
12 May 2017 at 16:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
gnugetComment #3
jhodgdonHm. This patch doesn't seem quite right:
This should not be optional but required.
Also, can you give more details about the WSOD and why this patch fixes it? I guess I haven't tried running the tests on a recent 8.3.x or 8.4.x probably...
Comment #4
gnugetSure!
Basically
Drupal\config_help\HelpViewBuilderoverwritecreateInstanceto inject$container->get('token')but forgot to inject:$container->get('language_manager')(seeEntityViewBuilder::createInstance) and that throws the following error:Also after to inject the dependency I got this warning:
Which basically is because: \Drupal\config_help\Element\TextSections::preRenderSections() shouldn't expect a reference but a value (see Drupal\Core\Render\Renderer::doRender() in this part:
There should exists an & before the
$elementsif it wanted to pass the reference instead to the value, in my patch I just removed the & from the function signature.I'm agree with you but that is how it appears in the parent class (see Drupal\Core\Entity\EntityViewBuilder::__construct()) so I didn't want to change it.
Comment #6
jhodgdonSo, if I didn't say it before.. and I didn't -- THANKS for your interest in reviving this module and fixing it up!
So, I think when you said language manager in #4, you really meant the theme registry. It looks like that was added to the core EntityViewBuilder class sometime between 8.1.x and 8.2.x, which is why my class didn't have it -- I created this a while before that and apparently hadn't run the tests since 8.1.x. So, I adopted pretty much your patch, but not making the theme registry optional as you did. I don't see a reason for that. I think the parent class did this to maintain backwards compatibility, but we don't have to worry about that since this module is still a sandbox so it hasn't had a release yet.
And I agree you are correct about preRender functions not wanting &$element. So, adopted that part of your patch too.
Anyway, I've now run the tests for this module against the latest Drupal 8.3.x (I think Drupal 8.4.x is not much different). Your patch fixes all the failures. So, committed (with changes noted above). Thanks again!