Needs work
Project:
Drupal core
Version:
main
Component:
field system
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
11 Mar 2015 at 18:23 UTC
Updated:
30 Jan 2023 at 20:51 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
prateekMehta commentedComment #2
yched commentedThat's a bit distant now, but it might be that we put it there so that $item->_attributes are initialized before we call hook_entity_prepare_view() - see rdf_entity_prepare_view()
We might want to re-check the discussion and patch from #1778122: Enable modules to inject attributes into field formatters, so that RDF attributes get output
Comment #3
plachThis is no longer added by #1867518: Leverage entityDisplay to provide fast rendering for fields, but the problem remains.
Comment #9
gribnif commentedA user of a module I maintain is reporting that this is an issue for him: #2939741: Installing Monster Menus on Drupal 8 causes InvalidArgumentException
It looks as though rdf_entity_prepare_view() is expecting _attributes to be set, and if it is not that causes an error:
I propose that rdf_entity_prepare_view() should initialize _attributes if it is unset. See my patch.
Comment #10
dawehner@Gribnif
Thank you for your patch! I'm curious, did you do some investigation figuring out why
_attributeswasn't set in your case?Comment #11
gribnif commented@dawehner: No, unfortunately, I cannot reproduce the specific problem the other user is reporting in the ticket I referenced. However, I can definitely see that it *could* be a problem, based on this ticket. So that is why I made the patch.
Comment #13
gribnif commentedI can definitely reproduce the problem now, but I can't see exactly why $item->_attributes is unset. However, there are numerous places in the code with lines like this, from core/modules/link/src/Plugin/Field/FieldFormatter/LinkSeparateFormatter.php:
which unset
_attributes. Therefore, I think it prudent to just do the initialization, as outlined in #9.Comment #21
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.