- Issue created by @cbildstein
- Status changed to Fixed
over 1 year ago 1:26am 5 May 2023 - πΊπΈUnited States balajidharma
Issue fixed when fixing Issue #3357153
Automatically closed - issue fixed for 2 weeks with no activity.
When having the "Restrict to parent" setting enabled, if you visit a node that belongs to a parent menu item and it is the ONLY child, you'll see a Drupal warning message about "Undefined array key".
Example warning message:
Warning: Undefined array key "main" in Drupal\menu_pager\Plugin\Block\MenuBlock->menuPagerGetNavigation() (line 283 of modules/contrib/menu_pager/src/Plugin/Block/MenuBlock.php).
Drupal\menu_pager\Plugin\Block\MenuBlock->menuPagerGetNavigation(Object, 1) (Line: 184)
Drupal\menu_pager\Plugin\Block\MenuBlock->build() (Line: 171)
Drupal\block\BlockViewBuilder::preRender(Array)
call_user_func_array(Array, Array) (Line: 101)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 788)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 374)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 204)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 160)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 161)
Drupal\Core\Render\Renderer->renderPlain(Array) (Line: 175)
Drupal\Core\Render\Renderer->renderPlaceholder('callback=Drupal%5Cblock%5CBlockViewBuilder%3A%3AlazyBuilder&args%5B0%5D=menupagermainnavigation&args%5B1%5D=full&args%5B2%5D&token=0_cyHwwBOFUTBFeK5CjtVkePhMbaiiSE9rUsT40opBg', Array) (Line: 693)
Drupal\big_pipe\Render\BigPipe->renderPlaceholder('callback=Drupal%5Cblock%5CBlockViewBuilder%3A%3AlazyBuilder&args%5B0%5D=menupagermainnavigation&args%5B1%5D=full&args%5B2%5D&token=0_cyHwwBOFUTBFeK5CjtVkePhMbaiiSE9rUsT40opBg', Array) (Line: 547)
Drupal\big_pipe\Render\BigPipe->sendPlaceholders(Array, Array, Object) (Line: 305)
Drupal\big_pipe\Render\BigPipe->sendContent(Object) (Line: 112)
Drupal\big_pipe\Render\BigPipeResponse->sendContent() (Line: 381)
Symfony\Component\HttpFoundation\Response->send() (Line: 20)
Example menu structure to re-produce the issue:
Check the array before trying to return the pager navigation.
Fixed
3.0
Code
Issue fixed when fixing Issue #3357153
Automatically closed - issue fixed for 2 weeks with no activity.