Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
$index->item_type is not the same as $index->getEntityType() and is not guaranteed to be the Entity type (it differs for search api entity translation for example). Here is a patch to fix this.
Comment | File | Size | Author |
---|---|---|---|
#7 | 2711499-7--result_entity_type.patch | 1.32 KB | drunken monkey |
Comments
Comment #2
gnucifer CreditAttribution: gnucifer commentedComment #3
gnucifer CreditAttribution: gnucifer commentedComment #4
drunken monkeyThanks for spotting this. The whole function is a mess, it seems to me, but since I have no idea what's going on there, I unfortunately have no way of fixing it.
Your patch looks quite sensible, though – however, since
getEntityType()
can returnNULL
, this code would result in chaos for non-entity indexes. I think my revised patch should work better, and also fix another stupid mistake in that function (or it's on purpose and I just don't understand it – please test/review and be the judge of that!).In any case, thanks a lot again for posting this!
Comment #5
drunken monkeyCould you please give my patch a short try to determine whether it solves your problem? Then I can commit it.
Comment #6
gnucifer CreditAttribution: gnucifer commentedThanks for your comments. Sorry about the late reply. Good catch, to me it looks like the whole block can be removed:
since neither $info nor $index is referenced below. I don't have to possibility to upload a new patch right now, but as far as I can see that block should go.
Comment #7
drunken monkey$index
is referenced below (in the second change of the patch, in fact), so I don't think it can go.What can go is the key in the
foreach
loop, though.Otherwise, does the patch work for you?
Comment #8
gnucifer CreditAttribution: gnucifer commentedOh, I must have missed that. Yes the patch looks good to me!
Comment #10
drunken monkeyOK, good to hear. Thanks for reviewing!
Committed.