Needs work
Project:
Drupal core
Version:
main
Component:
entity system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Nov 2019 at 18:50 UTC
Updated:
19 Nov 2024 at 03:16 UTC
Jump to comment: Most recent, Most recent file







Comments
Comment #3
webchickComment #4
rlnorthcuttThe attached patch makes a very simple change to the showRevisionUi() method on content entity forms. It checks to make sure that this is NOT a new entity in order to display the revision field.
Comment #5
rlnorthcuttNote that this patch works for nodes, but doesn't seem to work for media.
Comment #6
berdirComment #8
berdirSeems like it's working too for media based on the test fails.
For the record, I'm fairly sure this was done like this on purpose, what we've done is to hide the checkbox and keep this. The first revision can still have a comment.
Comment #9
berdir> the visual prominence is overwhelming and takes attention away from the task at hand.
Don't disagree with that, wondering how that looks in Claro? Also, if we were to apply the sidebar layout of the node form to to other forms then that might help with that?
Comment #10
rlnorthcuttI found a much more effective change. It simply hides the revision information on new entity forms. This means it can be undone by a form alter (vs. an unset).
This helps to provide a cleaner UX for authors, it is easily reversible by contrib, and works for nodes as well as media
Comment #11
anavarreAdding a few before/after screenshots.
Comment #12
lauriiiComment #13
aleevasFixed filed tests from #10
Comment #14
kevinfunkI've tested the patch in #13 and can confirm that the revision log message is not shown when creating a new block, node, or media item and it is shown when editing a block, node, or media item.
Comment #16
priyanka.sahni commentedComment #17
priyanka.sahni commentedVerified and tested by applying patch#13.It looks good to me.Moving it to RTBC.
Steps to test -
1. Go to the admin site.
2. Go to /admin/content -> Click on Create content type.
3. Verify if revision log is available or not.
4. Go to /admin/content/media ->Click on Create media.
5. Verify if revision log is available or not.
6. Go to admin/structure/block/block-content -> Click on Create block.
7. Verify if revision log is available or not.
Content Type -

Block -

Media -

Comment #18
alexpottThis is better written as
I.e. without the if. This is so the form keys don't change. Makes things simpler for alters.
it makes me wonder if the correct fix is for
\Drupal\Core\Entity\ContentEntityForm::showRevisionUi()to beComment #19
deepak goyal commentedComment #20
deepak goyal commentedHi @alexpott
Updated point 1 please review.
Comment #21
alexpottI think we need an explicit test plus #18.2 and #18.3 probably should be addressed.
Comment #26
mandclu commented+1 for getting this changed, it would be a big improvement.
Comment #27
andregp commented@alexpott I tried to address the points #18.2 and #18.3 on this new patch.
Regarding the #18.2 I tried to use
instead of the approach on the patch, but it had the opposite desired effect. I discovered that in some cases the default code already hides the revision field on the creation of new content types, and by changing this return line the revision field starts to appear. (see on "..._alternative_code" pictures).
About #18.3 I added the additional validation. I wasn't able to test with required revision fields, but at least this field isn't showing when, for example, I try to create a new block.
One concern that I got when working on this issue is about the code removal from PagePreviewTest::testPagePreviewWithRevisions. The name of the test refers to testing the page "with revisions" so removing the assertion that checks the revision just to make it pass doesn't sound as the right approach. Maybe rebuild the test, or remove it entirely an replace with a more specific one? I'm not an expert so I don't know what is the right thing to do.
Keeping on needs work as it still needs dedicated tests.
Comment #28
andregp commentedAddressing the test fails.
Comment #29
andregp commentedSorry, I didn't mean to change the status.
It still needs work as we still need dedicated tests.
Comment #30
Johnny Santos commentedIm going to give it a try with the tests
Comment #32
mlncn commentedAny luck with the tests, Johnny Santos, or should this be un-assigned?
Comment #34
bkosborne+1 to this, very unexpected to have this shown on new entity forms
Comment #35
pbouchereau commented