Islandora / documentation

Contains islandora's documentation and main issue queue.
MIT License
104 stars 71 forks source link

PHP error seen when rendering a collection page #1427

Open bseeger opened 4 years ago

bseeger commented 4 years ago

When I view a collection page, I see an error in the Reports log:

Screen Shot 2020-02-05 at 9 01 10 AM

Overall, it seems pretty innocuous, as it doesn't seem to affect anything.

Full messages:

Message | Symfony\Component\Routing\Exception\InvalidParameterException:  Parameter "block_id" for route "context.reaction.blocks.block_edit"  must match "[^/]++" ("" given) to generate a corresponding URL. in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 204 of /var/www/html/drupal/web/core/lib/Drupal/Core/Routing/UrlGenerator.php).
Notice: Undefined index: uuid in Drupal\context\Plugin\ContextReaction\Blocks->execute() (line 222 of /var/www/html/drupal/web/modules/contrib/context/src/Plugin/ContextReaction/Blocks.php) #0 /var/www/html/drupal/web/core/includes/bootstrap.inc(596): _drupal_error_handler_real(8, 'Undefined index...', '/var/www/html/d...', 222, Array) #1 /var/www/html/drupal/web/modules/contrib/context/src/Plugin/ContextReaction/Blocks.php(222): _drupal_error_handler(8, 'Undefined index...', '/var/www/html/d...', 222, Array) #2 /var/www/html/drupal/web/modules/contrib/context/src/Plugin/DisplayVariant/ContextBlockPageVariant.php(109): Drupal\context\Plugin\ContextReaction\Blocks->execute(Array, Object(Drupal\Core\Render\Markup), Array) #3 /var/www/html/drupal/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(259): Drupal\context\Plugin\DisplayVariant\ContextBlockPageVariant->build() #4 /var/www/html/drupal/web/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)) #5 /var/www/html/drupal/web/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)) #6 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #7 /var/www/html/drupal/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #8 /var/www/html/drupal/vendor/symfony/http-kernel/HttpKernel.php(156): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent)) #9 /var/www/html/drupal/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #10 /var/www/html/drupal/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #11 /var/www/html/drupal/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #12 /var/www/html/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #13 /var/www/html/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #14 /var/www/html/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #15 /var/www/html/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #16 /var/www/html/drupal/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /var/www/html/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(694): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /var/www/html/drupal/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #19 {main}.

@dannylamb Thinks this is related to Contexts.

dannylamb commented 4 years ago

I managed to fix it with this:

diff --git a/src/Plugin/ContextReaction/Blocks.php b/src/Plugin/ContextReaction/Blocks.php
index 1f72a02..905466b 100644
--- a/src/Plugin/ContextReaction/Blocks.php
+++ b/src/Plugin/ContextReaction/Blocks.php
@@ -219,7 +219,7 @@ class Blocks extends ContextReactionPluginBase implements ContainerFactoryPlugin
           'route_parameters' => [
             'context' => $configuration['context_id'],
             'reaction_id' => 'blocks',
-            'block_id' => $block->getConfiguration()['uuid'],
+            'block_id' => $block->getConfiguration()['uuid'] ?? $this->uuid->generate(),
           ],
         ];

Blocks generated by views don't get uuids, so that param was getting set wrong. By minting a new uuid, the rest of the downstream code is satisfied. Not sure how clean that is, but it was quick and easy enough. I'll be making an issue and patch to the context module with this.

bseeger commented 4 years ago

Just confirming that this works nicely for me as well.

elizoller commented 3 years ago

@bseeger do you know if context module fixed this?