Needs review
Project:
Rabbit Hole
Version:
2.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
24 Aug 2023 at 16:03 UTC
Updated:
4 Sep 2026 at 13:03 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
keshavv commentedComment #3
nsciaccaI got a similar error with Views Bulk Operations:
Error: Call to undefined method Drupal\views_bulk_operations\Form\ConfigureAction::getEntity() in Drupal\rabbit_hole\Plugin\Field\FieldWidget\RabbitHoleDefaultWidget->formElement() (line 168 of modules/contrib/rabbit_hole/src/Plugin/Field/FieldWidget/RabbitHoleDefaultWidget.php).
Adding the below check to the top of the formElement function works for my instance.
Comment #4
ayush.pandey commentedHi, the issue seems to not reproducible. I tried the module version 2.0.0-alpha5 with drupal 10.1 and the node gets saved successfully with the media entity. Please check once, and add complete steps if its still reproducible .
Comment #5
karimbou commentedHaving this issue on production Drupal 9.5.x and rabbit_hole 2.0.0-alpha5
Creating a new article and trying to open entity browser through a paragraph (popup entity browser show the error)
Comment #6
karimbou commentedTo avoid some warnings on $form['#type'] array key, that might not exist i've added an isset to the patch.
Comment #7
alexdoma commentedpatch #6 now working for me
i have get code from https://www.drupal.org/project/hide_revision_field module and its helps for me
drupal 10.1.3
Comment #8
julianvj commentedNot able to reproduce this issue on Drupal 10.1.9 with RabiitHole 2.0.0-alpha5 and Entity Browser 2.10.
This seems to be a very special use case or applicable onty to Drupal 9
Comment #9
philip_stier commentedI was also getting this exact same error with Entity Browser. #6 worked for me. Drupal 10.1.7
Comment #10
interdruper commentedBoth #6 and #7 fix the problem. Thanks.
Comment #11
interdruper commentedComment #12
andreasderijckeStill a problem for 2.0.0-alpha5 in combination with
The error only appears in this combination when you try to bulk edit nodes that allow rabbit hole overrides.
Comment #13
greg boggsAfter applying #6 in Drupal 10.3, I get a new error when applying a modify data VBO action.
Error: Call to a member function getEntityTypeId() on null in Drupal\rabbit_hole\Plugin\Field\FieldWidget\RabbitHoleDefaultWidget->formElement() (line 166 of modules/contrib/rabbit_hole/src/Plugin/Field/FieldWidget/RabbitHoleDefaultWidget.php).
Comment #14
greg boggsComment #15
nicodh commented#7 works for me in #13 use case
Comment #16
oriol_e9gReroll.
Comment #17
damienmckennaComment #18
ishani patel commentedFacing the same issue, and applying the #7 patch worked for me.
Thanks!
Comment #19
anybodyCould someone please create a MR from the patch? Doesn't sound minor to me.
Comment #20
coulton commentedApplied Patch #7 which has worked for me. On Drupal 11.3.8
Comment #23
rcodina@anybody Patch on #16 works for me on Drupal 11.3.16 and Rabbit Hole 2.0.0-beta2. So I have created a MR using it.
Comment #24
rcodinaFollowing up on my previous comment: the pipeline on the MR is red, but I do not think the patch in #16 is the cause.
Only
phpunitactually blocks. phpcs, phpstan and eslint areallow_failure: true, and they were already failing in the last green 2.0.x pipeline (pipeline 759534, March 2026).The 7 phpunit errors are all the same one, and they all happen in
setUp(): aLogicException: Missing bundle entity, entity type node_type, entity id article.thrown fromsrc/Entity/BehaviorSettings.php:245. Both test classes use thestandardprofile and then save aBehaviorSettingsfornode.article. Since Drupal 11.4 the Standard profile no longer ships the Article content type —core/profiles/standard/config/install/node.type.article.ymlis there in 11.2.0 and 11.3.0, but gone in 11.4.5, which is what the pipeline installs — socalculateDependencies()throws. The patch only touchesformElement(), which is never reached in those tests.I did tidy the patch slightly in the MR, hopefully in the spirit of the original:
elseif/elseon their own lines (removes the 3 new phpcs errors it added), plus a?? $items->getEntity()fallback in thecontainerbranch so$entityis always defined.The test failure probably deserves a separate issue, something like "Functional tests fail on Drupal 11.4: the Standard profile no longer provides the Article content type"; the fix would likely be creating the bundle in
setUp()with$this->drupalCreateContentType(['type' => 'article'])instead of relying on the profile. I will not be able to work on that one myself, but happy to test a patch if someone picks it up.The failing traces, for reference:
Comment #25
rcodinaFollow-up on the pipeline: the phpunit failures are unrelated to this patch. The root cause is core #3587118: Remove content types from the standard install profile and recipe, which removed the content types from the Standard install profile in 11.4, so the two Functional tests that declare
$profile = 'standard'no longer get the Article bundle they save Rabbit Hole settings for. They error insetUp(), before any of the code this issue touches runs.It was already fixed on 8.x-1.x by Jakob P in merge request 117 (commit a9e6f362), but 2.0.x has not had it yet. I have applied the same guard here, in both
RabbitHolePageRedirectActionTest::setUp()andRabbitHoleBehaviorFunctionalTest::setUp():It is in its own commit, so it is easy to drop if you would rather see the test fix handled on its own — #3576742: Fix PHPUnit tests on 8.x-1.x was closed with a note about moving to 2.0.x for the rest, so it may already be on its way. It should get the Functional tests past
setUp()at least; what happens after that has never actually run on 11.4 on this branch, so there may be more to fix.