Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
entity system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
18 Mar 2014 at 18:43 UTC
Updated:
2 Feb 2015 at 18:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
benjy commentedAs discussed on IRC the settings key is always required so we should just enforce this in ComponentEntityDisplayBase.
Comment #3
berdirI'm wondering if we shouldn't move this to EntityBaseDisplay::setComponent() and ensure that settings is present there. Then we can also ensure it for code other than migrations.
Comment #4
benjy commentedYeah that would make more sense to me.
Comment #6
berdirInteresting, I think those tests are wrong because those definitions would result in the mentioned errors when actually used.
Maybe @swentel can help us out here? :)
Comment #7
swentel commentedSo yeah, those tests should be changed, weird that we missed this.
Comment #8
berdirCool, should make a pretty easy novice issue then to fix the assertion in those tests.
Comment #9
visabhishek commentedI have updated the patch please review.
Comment #11
swentel commented@visabhishek you can just take the patch from #4 and then fix the assertions in EntityDisplayTest and EntityFormDisplayTest
Comment #12
swentel commentedComment #13
swentel commentedHmm, so come to think of it. It doesn't make sense to have a settings key for extra fields because they don't go through the formatter plugin manager.
Comment #14
swentel commentedSo this should do it.
Comment #15
berdirGreat, discussed with @swentel, looks good.
Comment #16
webchickCan we get a test for this? (Not the specific regression itself, but whatever it is that triggers a recoverable fatal error when the fix missing.)
Comment #17
berdirHm, not sure in which that would make sense. But maybe we can extend the migrate tests so that they test this? They're not yet in core, though.
Comment #18
berdirAh, what we can do in one of those entity display tests is setting a component for an actual widget and then getComponent() and ensure it has settings set.
Comment #19
swentel commentedHmm so, even with a widget with no settings, there is always a settings key. Especially since #2136197: Move field/instance/widget/formatter settings out of annotation / plugin definition, pluginSettingsBase has a defaultSettings() method which will always return an array anyway. (and possibly that was ok before that too) So not sure if we still need the protection ...
Comment #20
joshi.rohit100last patch failed to apply so created this
Comment #22
amitgoyal commentedThere are minor issues with the patch in #20 - "warning: 2 lines add whitespace errors.".
Please review revised patch as it applies cleanly.
Comment #24
l0keChanging the assertions to make tests pass.
Comment #25
m1r1k commentedComment #28
hampercm commentedTaking a look at this for NERDSummit2014
Comment #29
hampercm commentedReroll of patch from #24.
Auto-merge
Comment #30
dawehnerYou could just use $options += ['settings' => []] instead of the if()
Comment #32
henk commentedI am looking on it now.
Comment #33
henk commentedReroll of patch from #29, core/modules/entity/src/Tests/ was moved to core/modules/field_ui/src/Tests/. I am not sure if "'settings' => array()" in each assert is needed if we have "if(!isset($options['settings']))" in setComponent method?
Comment #34
henk commentedneeds review
Comment #36
henk commentedonce again #33
Comment #38
henk commentedComment #40
henk commentedpass unittest
Comment #41
benjy commentedI think that initialising third_party_settings would also fix this Migrate issue? #2394615: User Profile entity form display need third_party_settings initialised
Comment #42
benjy commentedI tested this and it does indeed fix the migrate issue. I think this is the best place for it, if there is no reason not to initialise third_party_settings as well then i'm going to close #2394615: User Profile entity form display need third_party_settings initialised in favour of this.
Comment #43
berdirYes, this makes perfect sense to me, that's the issue I wanted to link to from the user profile migrate one. The API should ensure that those keys are set, especially given that we then rely on them.
Comment #44
henk commentedComment #45
alexpottThis issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed 1867d61 and pushed to 8.0.x. Thanks!