Problem/Motivation
The method should not hardcode defaults, that dates back to when nodes were dumb objects, now Node::create() takes care of all the default values you need.
Specific example is that it still defaults langcode to undefined/und, while the field level default is now the site default language (en).
Proposed resolution
Remove all except those that set random values where there is no default (title/body)
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#3 | drupal-create-node-2333731-3-interdiff.txt | 20.46 KB | Berdir |
#3 | drupal-create-node-2333731-3.patch | 23.19 KB | Berdir |
#1 | drupal-create-node-2333731-1.patch | 2.73 KB | Berdir |
Comments
Comment #1
BerdirAtleast some node access language tests are failing , let's see what else.
Comment #3
BerdirFixing those tests. Most are because they assumed that the default langcode is und, not en. Some others because the default value for promote is true, not false.
Comment #4
dawehnerSome of the tests in NodeAccessLanguageTest are now kinda stupid, but we check the created node also for specific langcodes like 'hu'
in there, so no problem here.
There is no change record for #1966436: Default *content* entity languages are not set for entities created with the API so we especially don't really need one here.
Comment #5
Gábor HojtsyThis looks **amazing**. Covers the test changes we did not want to include in #1966436: Default *content* entity languages are not set for entities created with the API perfectly. :)
Comment #6
alexpottNice :) Committed 537cc87 and pushed to 8.0.x. Thanks!
Comment #8
Gábor HojtsyThis is so great. Thanks a lot!