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).

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bhogue created an issue. See original summary.

bhogue’s picture

Issue summary: View changes
justinchev’s picture

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.

Incidentally I'm using the Gin admin theme, in case that has any bearing on things.

anybody’s picture

Version: 2.1.3 » 3.0.x-dev
Status: Active » Needs work

For now, I added a clearer error handling because I'm still unsure about the root cause and the correct fix.

benstallings made their first commit to this issue’s fork.

benstallings’s picture

Status: Needs work » Needs review
anybody’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, this at least improves the error handling, for that reason it should get committed asap. Can we find the root cause in a follow-up?

Closed #3589148: Error: Call to a member function getEntity() on null in Drupal\layout_paragraphs\Form\EditComponentForm->buildForm() (line 31 of /var/www/html/web/modules/contrib/layout_paragraphs/src/Form/EditComponentForm.php). as duplicate, please credit @bramdriesen.

justin2pin’s picture

Fixed upstream for 3x in the LayoutParagraphsLayout API class with this commit:
https://git.drupalcode.org/project/layout_paragraphs/-/commit/a966d468f2...

justin2pin’s picture

Version: 3.0.x-dev » 2.2.x-dev
Status: Reviewed & tested by the community » Needs work

This should be fixed in 3x but is still an issue in 2x, and is blocked until cypress tests in 2x are merged / fixed.