Updated: Comment #17
Problem/Motivation
The ' Display author and date information.' and other node-type settings for content types are ignored when turned off
Steps to reproduce
- Create a content type
- Uncheck ' Display author and date information.'
- Create a node of that type
- View node in bartik theme
- Result:
Proposed resolution
Ensure that node options and submitted variables are written as booleans to the node-type config entity.
Update node-type schema to flag these as booleans.
Update NodeType::getExportedProperties to correctly type these properties (ConfigEntityBase ignore config schemas).
Ensure config() isn't used to access node settings, use the config entity instead.
Remaining tasks
Reviews
User interface changes
None
API changes
None
Related Issues
None
Original report by @Mark Carver
"Display author and date information." checkbox on content types does not work. Introduced by #111715: Convert node/content types into configuration.
Steps to reproduce:
- Create new page and submit.
- Toggle "Display author and date information." on content type and watch it not change.
Need to test for this in the future.
Comment | File | Size | Author |
---|---|---|---|
#35 | 2053461-node-options-35.patch | 12.53 KB | andypost |
#35 | interdiff.txt | 5.33 KB | andypost |
#26 | node-post-settings-2053461.24.patch | 13.1 KB | larowlan |
Comments
Comment #1
tim.plunkettHere's the fix, we need tests.
Also, the comment above this line says to not load the config entity, but that would have prevented this bug...
Comment #3
tim.plunkettThis is a bigger problem than I thought.
The default value is only applied on the form level, not the entity level.
Also, tests can create nodes of node types that don't exist.
Finally, NodeTestBase creates a page node type that doesn't match the expectations of the standard profile config.
Comment #4
markhalliwellCan't really see with just the context lines, but are we also switching it on and testing that it shows up too?
Comment #5
markhalliwellwtf... tagging is screwed up. This wasn't even in the field.
Comment #7
tim.plunkettYep. Also need to fix those other tests.
Comment #8
tim.plunkettFixed, expanded tests. Should be good now.
Comment #10
tim.plunkettLast one.
Comment #11
swentel CreditAttribution: swentel commented#2104857: Display settings unchecked but still showing up also has a green one
Comment #12
aspilicious CreditAttribution: aspilicious commented\Drupal:: in stead of Drupal::
Comment #13
swentel CreditAttribution: swentel commentedrerolled, lot of things have moved in since august.
Comment #15
larowlanI vote we close this tackle as part of bigger issue in #2111091: Node type settings such as published state, promoted state, author information cannot be turned off, the issue also effects the status, promote and revision options. Thoughts?
Comment #16
tim.plunkettThis addresses those, just not in the issue title... But as long as the approaches are merged, I don't care. The two issues have completely different code ATM.
Let's chat on IRC later.
Comment #17
larowlanSure.
Fwiw I tested this manually before my 'vote', it fixes submission details, but not promoted our published so that's why I thought it had a narrower scope.
Comment #18
larowlanPatch combines #13 and #2111091: Node type settings such as published state, promoted state, author information cannot be turned off which was closed as duplicate of this.
Issue summary updated to reflect wider scope.
Lets see how many fails left.
Comment #19
larowlanNew title
Comment #21
larowlanThis is surely major with the wider scope.
Comment #23
larowlanMissed a call to setDefaultRevision in EditFieldForm::init
I've made some new git alias toys so here's hoping they worked
From my .gitconfig
Use like so - assuming branches are named {description}-{issuenumber}
Comment #24
larowlanand how about a patch this time?
Comment #25
jibranTypo
Comment #26
larowlanFixes #25
Comment #27
tim.plunkettCan we use entity_load('node_type', 'article') and set this properly?
We're apparently to use \Drupal over $this->container in tests.
It really sucks that we have to do this.
This cast is suspicious. Can we remove the getExportProperties if we remove this? And make the default FALSE not 0
O_o
I guess this is needed? Not sure why.
In a follow-up, we should profile using the full entity here, because breaking our own rule of not using config() for entities sucks.
Comment #27.0
tim.plunkettUpdated issue summary
Comment #28
andypostClosed duplicate #2158431: Hide author, date in nodes - does not work
Comment #29
victor-shelepen CreditAttribution: victor-shelepen commentedHello. I see you are investigating? Could you make a small patch to make it workable? I see this problem lives too long. Let's use work around.
Thank you.
Comment #30
andypostPatch has test coverage so it needs re-roll and address #27
@likin You could try to re-roll it.
Comment #31
andypostMerge with following changes:
- Addressed #27 review
- converted standard profile config for node types
- added @todo to clean-up rfd config for page node type, somehow comment was removed, probably in node type cmi conversion
Comment #33
andypostPatch adds fixes broken tests, that affected that "submitted" needs node-type entity config to display itself
Also #27.6 seems pointed to that, so the right fix would be to decide do we really need this this setting depend on node-type setting or use entity display somehow...
Removal of this shows that node needs node type entity to properly display submitted variable. And only that!
PS: Can't reproduce failures in
SimpleTestTest
andShortcutLinksTest
locallyComment #34
andypostClean-up patch
Comment #35
andypostright patch with interdiff
Comment #37
victor-shelepen CreditAttribution: victor-shelepen commentedIn my case it works well.
Comment #38
catchCommitted/pushed to 8.x, thanks!
Comment #39
xjm(Merging "node system" and "node.module" components for 8.x; disregard.)