Error: Call to a member function getEntity() on null in Drupal\layout_paragraphs\Access\LayoutParagraphsBuilderAccess->access()

Created on 27 August 2024, 3 months ago
Updated 19 September 2024, about 2 months ago

Full error:

Error: Call to a member function getEntity() on null in Drupal\layout_paragraphs\Access\LayoutParagraphsBuilderAccess->access() (line 72 of /var/www/html/web/modules/contrib/layout_paragraphs/src/Access/LayoutParagraphsBuilderAccess.php).

#0 [internal function]: Drupal\layout_paragraphs\Access\LayoutParagraphsBuilderAccess->access(Object(Drupal\Core\Session\AccountProxy), Object(Drupal\layout_paragraphs\LayoutParagraphsLayout), 'delete', '85516181-d470-4...', NULL)
#1 /var/www/html/web/core/lib/Drupal/Core/Access/AccessManager.php(160): call_user_func_array(Array, Array)
#2 /var/www/html/web/core/lib/Drupal/Core/Access/AccessManager.php(136): Drupal\Core\Access\AccessManager->performCheck('layout_paragrap...', Object(Drupal\Component\Utility\ArgumentsResolver))
#3 /var/www/html/web/core/lib/Drupal/Core/Access/AccessManager.php(113): Drupal\Core\Access\AccessManager->check(Object(Drupal\Core\Routing\RouteMatch), Object(Drupal\Core\Session\AccountProxy), Object(Symfony\Component\HttpFoundation\Request), true)
#4 /var/www/html/web/core/lib/Drupal/Core/Routing/AccessAwareRouter.php(107): Drupal\Core\Access\AccessManager->checkRequest(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Session\AccountProxy), true)
#5 /var/www/html/web/core/lib/Drupal/Core/Routing/AccessAwareRouter.php(92): Drupal\Core\Routing\AccessAwareRouter->checkAccess(Object(Symfony\Component\HttpFoundation\Request))
#6 /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php(105): Drupal\Core\Routing\AccessAwareRouter->matchRequest(Object(Symfony\Component\HttpFoundation\Request))
#7 [internal function]: Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest(Object(Symfony\Component\HttpKernel\Event\RequestEvent), 'kernel.request', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#8 /var/www/html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\RequestEvent), 'kernel.request', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#9 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(157): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\RequestEvent), 'kernel.request')
#10 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#11 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#12 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#13 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /var/www/html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#21 {main}

After updating the module to 2.0.6 or above from 2.0.4 (and core 10.3.1 or above), when I attempt to edit/delete a layout paragraph, instead of a modal opening to either make the edits or to confirm the deletion, instead a new page loads and presents either the form to edit or to confirm the deletion, but clicking Delete or Save does nothing the first time it is clicked. This error appears when I click it a second time. If I go back to 2.0.4 (and don't change anything else), it once again works as expected (modal opens and I can successfully edit or delete within the modal).

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @bhogue
  • 🇬🇧United Kingdom justinchev

    I was also experiencing this issue, with a similar error message. What I found is that it was only happening for users with a restricted user role, eg. my 'content editor' role. If I try and delete the paragraphs using my user 1 'admin' role, then it works fine.

    Using a process of elimination I've found that if I grant the 'content editor' the following permission, then they are able to delete the paragraph content items.

    System
    Link to any page
    Warning: Give to trusted roles only; this permission has security implications. This allows to bypass access checking when linking to internal paths.

Production build 0.71.5 2024