Problem/Motivation

In a recent study of the content authoring experience done by Dharmesh users found the newly introduced "Save and keep published" overly long and confusing.

Overly complex solution.

Proposed resolution

Because "Save and keep published"/"Save and keep unpublished" are both long and awkwardly worded, it makes sense to change them to a boolean_checkbox simplified to Published underneath which "Save", "Preview", and "Cancel" buttons would be included.

Also revert #2423153: Add menu from the editing page doesn't save the changes issue, since now we will have only one "Save" button (with the previously mentioned Published status checkbox) and we don't want to have these 4 buttons anymore:

  • Save and unpublish
  • Save and keep unpublished
  • Save and publish
  • Save and keep published

This is how it should look like now:

Proposed solution.

Remaining tasks

  • Create patch
  • Reviews

User interface changes

  • Change interface for publishing and unpublishing content.

CommentFileSizeAuthor
#309 save-button.png21.87 KBfdverwoerd
#299 publishing_status.png8.05 KBgillesv
#296 2017-09-06-151835_7680x2160_scrot.png17.21 KBpfrenssen
#295 2068063-295.patch64.76 KBflocondetoile
#293 2068063_292.patch109.3 KBkbasarab
#291 2068063_291.patch66.34 KBslashrsm
#285 2068063-285.patch64.49 KBManuel Garcia
#285 interdiff.txt571 bytesManuel Garcia
#285 node-add-smallscreen-285.png16.86 KBManuel Garcia
#285 node-add-widescreen-285.png26.59 KBManuel Garcia
#284 node-add-smallscreen.png14.06 KBManuel Garcia
#284 node-add-widescreen.png16.88 KBManuel Garcia
#284 2068063-284.patch64.47 KBManuel Garcia
#284 interdiff.txt544 bytesManuel Garcia
#283 spacing-on-small-screens.png90.56 KByoroy
#279 2068063-279.patch64.35 KBManuel Garcia
#279 interdiff.txt6.62 KBManuel Garcia
#275 2068063-275.patch70.97 KBManuel Garcia
#275 interdiff.txt1.65 KBManuel Garcia
#274 2068063-274.patch70.44 KBManuel Garcia
#273 2068063-273.patch70.31 KBManuel Garcia
#273 interdiff.txt7.27 KBManuel Garcia
#269 2068063-269.patch63.23 KBjonathan1055
#265 2068063-bartik-mobile.png66.18 KBvijaycs85
#265 2068063-bartik-desktop.png91.96 KBvijaycs85
#265 2068063-iphone6.png44.8 KBvijaycs85
#265 2068063-default.png63.92 KBvijaycs85
#265 2068063-update-start.png52.37 KBvijaycs85
#265 2068063-update-in-progress.png41.3 KBvijaycs85
#264 after-bartik.png18.15 KBManuel Garcia
#264 before-bartik.png16.79 KBManuel Garcia
#264 interdiff.txt1.01 KBManuel Garcia
#264 2068063-264.patch63.59 KBManuel Garcia
#263 2068063-263.patch62.99 KBManuel Garcia
#260 stark.png3.13 KBtimmillwood
#260 bartik.png3.97 KBtimmillwood
#260 seven.png5.38 KBtimmillwood
#251 2068063-251.patch63.24 KBBerdir
#247 2068063-247.patch63.15 KBtimmillwood
#247 interdiff-2068063-247.txt1.17 KBtimmillwood
#246 published-tickbox-with-workflow.png9.58 KBifrik
#241 after-article.png27.32 KBManuel Garcia
#240 after.png10.46 KBManuel Garcia
#240 before-article.png27.59 KBManuel Garcia
#240 after.png10.46 KBManuel Garcia
#240 before.png10.84 KBManuel Garcia
#239 interdiff.txt1.47 KBlauriii
#239 change_save_and_keep-2068063-239.patch63.12 KBlauriii
#238 2068063238.patch62.71 KBtimmillwood
#238 interdiff-2068063-238.txt3.84 KBtimmillwood
#237 Screenshot from 2017-04-25 11-28-17.png19.34 KBlauriii
#235 published-tickbox-with-translation.png7.46 KBifrik
#234 2068063-234.patch63.29 KBtimmillwood
#234 interdiff-2068063-234.txt566 bytestimmillwood
#230 2068063-230-after.png21.9 KBamit.drupal
#230 2068063-230-before.png28.99 KBamit.drupal
#228 2068063-228.png24.35 KBamit.drupal
#227 after.png22.86 KBManuel Garcia
#227 before.png23.06 KBManuel Garcia
#225 2068063-225.patch63.04 KBtimmillwood
#225 interdiff-2068063-225.txt1.39 KBtimmillwood
#206 2068063-205.patch62.9 KBtimmillwood
#206 interdiff-2068063.txt2.38 KBtimmillwood
#198 publish-buttons-options.png33.31 KByoroy
#198 silverstripe-publish-buttons.jpg20.26 KByoroy
#189 2068063-189.patch62.28 KBtimmillwood
#189 interdiff-2068063-189.txt2.13 KBtimmillwood
#189 Screenshot from 2017-03-15 14-08-38.png20.72 KBtimmillwood
#186 Screenshot from 2017-03-15 12-02-48.png22.5 KBtimmillwood
#186 2068063-186.patch62.03 KBtimmillwood
#186 interdiff-2068063-186.patch1.13 KBtimmillwood
#185 interdiff184_185.txt2.6 KBMunavijayalakshmi
#185 2068063-185.patch61.99 KBMunavijayalakshmi
#184 2068063-184-interdiff.txt1.9 KBBerdir
#184 2068063-184.patch62.02 KBBerdir
#182 2068063-182.patch61.33 KBtimmillwood
#182 interdiff-2068063-182.txt1.99 KBtimmillwood
#180 2068063-180.patch61.5 KBBerdir
#167 seven-with-content-moderation.png79.04 KBtimmillwood
#167 seven.png48.58 KBtimmillwood
#167 bartik-unpublished.png28.15 KBtimmillwood
#167 bartik-published.png27.96 KBtimmillwood
#167 2068063-167.patch63.76 KBtimmillwood
#167 interdiff.txt2.93 KBtimmillwood
#164 2068063-164-interdiff.txt4.91 KBBerdir
#164 2068063-164.patch61.74 KBBerdir
#161 save-publish-button.png27.78 KByoroy
#154 AfterPatch_Edit_Node.PNG9.42 KBTruptti
#154 AfterPatch_New_Node.PNG9.18 KBTruptti
#152 2068063-151.patch57.38 KBBerdir
#151 2068063-151.patch353.18 KBBerdir
#145 interdiff-142-145.txt575 bytesjofitz
#145 2068063-145.patch57.09 KBjofitz
#143 Selection_116.png14.62 KBBerdir
#143 Selection_115.png19.86 KBBerdir
#142 2068063-142-interdiff.txt1.45 KBBerdir
#142 2068063-142.patch57.1 KBBerdir
#140 2068063-140.patch56.57 KBBerdir
#135 2068063-135.patch56.5 KBtimmillwood
#135 interdiff.txt2 KBtimmillwood
#132 2068063-132.patch55.16 KBtimmillwood
#132 interdiff.txt1.16 KBtimmillwood
#130 change_save_and_keep-2068063-130-interdiff.txt7.4 KBBerdir
#130 change_save_and_keep-2068063-130.patch56.03 KBBerdir
#128 change_save_and_keep-2068063-128.patch50.09 KBchr.fritsch
#124 change_save_and_keep-2068063-124-8.2.patch50.45 KBBerdir
#123 change_save_and_keep-2068063-123.patch50.24 KBBerdir
#119 change_save_and_keep-2068063-119.patch50.36 KBjohnchque
#117 change_save_and_keep-2068063-117.patch50.33 KBjohnchque
#115 Screenshot from 2016-10-11 10-34-52.png26.73 KBjohnchque
#115 change_save_and_keep-2068063-115.patch46.9 KBjohnchque
#94 save-published.png18 KByoroy
#82 node-save-published-2068063-82.patch47.16 KBtduong
#82 interdiff-2068063-80-82.txt226 bytestduong
#80 node-save-published-2068063-80.patch47.16 KBtduong
#80 interdiff-2068063-78-80.txt486 bytestduong
#78 node-save-published-2068063-78.patch47.11 KBtduong
#78 interdiff-2068063-76-78.txt949 bytestduong
#76 node-save-published-2068063-76.patch47.19 KBtduong
#76 interdiff-2068063-74-76.txt1.75 KBtduong
#74 interdiff-2068063-71-74.txt1.07 KBtduong
#74 node-save-published-2068063-74.patch46.04 KBtduong
#71 node-save-published-2068063-71.patch44.89 KBtduong
#71 interdiff-2068063-69-71.txt3.7 KBtduong
#69 node-save-published-2068063-69.patch45.05 KBtduong
#69 interdiff-2068063-67-69.txt22.63 KBtduong
#67 node-save-published-2068063-67.patch47.14 KBtduong
#67 interdiff-2068063-64-67.txt15.96 KBtduong
#64 node-save-published-2068063-64.patch44.31 KBtduong
#64 interdiff-2068063-62-64.txt7.11 KBtduong
#62 node-save-published-2068063-62.patch41.06 KBtduong
#62 interdiff-2068063-58-62.txt33.88 KBtduong
#58 node-save-published-2068063-58.patch4.24 KBBerdir
#58 node_save_published.png17.27 KBBerdir
#45 new_save_pattern.png167.35 KBtkoleary
#44 new_save_pattern.png167.95 KBtkoleary
#35 node_edit_draft.png39.12 KBesod
#35 node_edit.png37.06 KBesod
#35 node_add.png41.42 KBesod
#24 change_save_and_keep-2068063-24.patch20.44 KBnlisgo
#24 interdiff-2068063-19-24.txt805 bytesnlisgo
#11 change-save-and-keep-published-to-update-2068063-11.patch20.37 KBesod
#11 before.node_add.png42.91 KBesod
#11 before.node_edit.png46.46 KBesod
#11 after.node_add.png41.66 KBesod
#11 after.node_edit.png40.98 KBesod
#11 before.node_edit_draft.png42.13 KBesod
#11 after.node_edit_draft.png39.4 KBesod
#13 change-save-and-keep-published-to-update-2068063-13.patch2.55 KBesod
#19 interdiff-2068063-11-19.txt3.14 KBnlisgo
#19 change_save_and_keep-2068063-19.patch20.65 KBnlisgo
#26 interdiff-2068063-24-26.txt6.1 KBnlisgo
#26 change_save_and_keep-2068063-26.patch20.48 KBnlisgo
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Does that mean that we have either:

  • Update
  • Save and unpublish

and in the case of unpublished

  • Update
  • Save and publish

There seems to be no context anymore that a post is published or unpublished.

tkoleary’s picture

That's a good point. We need to deal with drafts as well. The common practice is this:

  • Update
  • Save as draft

and in the case of unpublished

  • Update draft
  • Save and publish

We have shied away from using "draft" I think because of worries about confusion with workflow, however I think that's the tail wagging the dog. Draft is the common nomenclature for a post that is not published.

The other issue with this is that we are overloading the submit with when we have "save as unpublished" which both saves and unpublishes the node. Unpublish is available in the content list which I suspect is where users commonly use it. Removing unpublish from the submit makes "save as draft" what most users expect "Save a revision that I can work on without unpublishing the current published version". This is possible in core now and I'm not sure why we're not using it.

tkoleary’s picture

Issue summary: View changes

Just noticed that we now have "save and keep unpublished". Oh my god.

How many verbal knots are we going to tie ourselves in before we realize that this is wrong?

tkoleary’s picture

Version: 8.0.x-dev » 8.0.0-beta1
Bojhan’s picture

Version: 8.0.0-beta1 » 8.0.x-dev
Issue tags: -#submit, -add new content, -Add Save +Usability

We fix this in dev. Its indeed a bit weird, what we are doing with that. A patch for this should be easy.

tkoleary’s picture

@bojhan

What's your preferred nomenclature?

Bojhan’s picture

@tkoleary I would favour the terminology that you use.

tkoleary’s picture

@Bojhan

Cool, so just to update since #2 did not encompass the whole interaction it would be:

New node:

Save and publish | Save draft

On saving draft the DSM could say "Draft has been saved. [Content title] is no longer published. Click "save and publish" to make this draft live.

Draft (unpublished)

Update draft | Save and publish

On updating draft the DSM could say "Draft has been updated. Click "save and publish" to make this draft live.

Published node

Update | Save draft

On updating draft the DSM could say "[content title] has been updated. Click "save draft" to unpublish while editing"

The only changes here from #2 are that this covers the new node, which does not follow "update" since it has never been saved, and that I changed "save as draft" to "Save draft" since commonly "save as" operations imply a copy has been created which is not the case here.

Bojhan’s picture

Status: Active » Needs work
Issue tags: +Novice

Good point about the "save as". It probably makes sense to split of the DSM changes, although connected I imagine it needs a bit more thinking than the labels because we don't do that now.

Patches please!

tkoleary’s picture

@dawehner

Since Bojhan and I are both non-coding designers would you mind rolling a patch of this? :)

esod’s picture

These show up in quite a few tests. Let's see what happens during testing.

The DSMs for Draft messages are probably be a bit more involving. The isNew() function helps to create a distinction between the "... has been created." message and "... has been updated." message. I don't see an isDraft() function which would make it easy to set conditions for the "... has been updated." message. I'll keep looking.

BEFORE node_add.png







AFTER node_add.png







BEFORE node_edit.png







AFTER node_edit.png







BEFORE node_edit_draft.png







AFTER node_edit_draft.png


Status: Needs review » Needs work

The last submitted patch, 11: change-save-and-keep-published-to-update-2068063-11.patch, failed testing.

esod’s picture

Status: Needs work » Needs review
FileSize
2.55 KB

Well, maybe I'm not supposed to change the test scripts. Let's try the patch with just the changes on NodeForm.php.

Status: Needs review » Needs work

The last submitted patch, 13: change-save-and-keep-published-to-update-2068063-13.patch, failed testing.

Bojhan’s picture

I am just wondering - doesn't "save as draft" actually more accurately describe it. Because you are actually having two different "versions" of the same thing here. The "live" one and the "future revision" one. It is special to the other ones, were you just have the one version.

@tkoleary what do you think?

yoroy’s picture

Nice labelling improvements me thinks. I do wonder about this one though (I think this is what bojhan means as well):

AFTER node_edit.png

Wouldn't it have to be Save *as* in this case because we're indeed splitting off a draft version from an existing, published node?

esod’s picture

Sure. We can change that one or any other other one that @tkoleary likes.

I'd like to know why my patch fails testing. It works on my local and it works on SimplyTest.me.

nlisgo’s picture

@esod, let me take a look.

nlisgo’s picture

Well I'm of no use. I seem to be getting the error when testing FileFieldDisplayTest locally on 8.0.x HEAD locally!!

Is it possible that a bug has crept into core and this in unrelated?

I am going to upload a new patch because I think you mixed up some of the changes in text.

See attached interdiff.

nlisgo’s picture

Status: Needs work » Needs review

The last submitted patch, 19: change_save_and_keep-2068063-19.patch, failed testing.

yoroy’s picture

Getting closer though, only 3 test fails left!

esod’s picture

Thanks @nlisgo for your help. Will you describe in detail what you are doing when you say "I seem to be getting the error when testing FileFieldDisplayTest locally on 8.0.x HEAD locally!!"

I'm following the instructions from https://www.drupal.org/node/2116263, but I'd like to know more about the tests so I can get more patches to pass.

nlisgo’s picture

Here's another attempt

Bingo!

nlisgo’s picture

@esod, I'll look into the issues I was having with the tests and perhaps contact you directly if I have a breakthrough. But my problems are definitely unrelated to this one.

nlisgo’s picture

Incorporated the feedback from #15 and #16 changing 'Save draft' to 'Save as draft'.

esod’s picture

Sweet. I'll have a look at your passed patch and the interdiff. I'm sure that will help me too.

esod’s picture

Now that we've resolved the issue with the text in the button(s), how do you think we could customize the draft messages per @tkoleary's suggestions in #8? There's only $insert and isNew() to work with at the moment.

Berdir’s picture

Wouldn't it have to be Save *as* in this case because we're indeed splitting off a draft version from an existing, published node?

No we don't. We unpublish the node and save that.

Which I think means this pretty misleading, Save as Draft or Save Draft not making a big difference. "Save and unpublish" is exactly what it does..

Bojhan’s picture

@Berdir That is a huge WTF, why the hell do we do that?

esod’s picture

It's always worked this way. In D7 when you un-publish a node and Create a new revision, the node's status column in the database is changed to 0 and the vid column (revision column) is given to a new integer.

In D8, the data structure has changed somewhat so that when you un-publish a node and Create a new revision, the node's vid column is given a new integer and the node_field_revision's table status column is changed to 0.

Either way the action is the same. A revision doesn't make a new node, it changes things for the existing node.

So, Save and unpublish is the literal action, but it is suggested that Save and unpublish (and its variants) will be confusing to the end user. If the end user knows or will intuit that Save Draft/Update Draft will apply to unpublished nodes, the changes we want to implement will be fine.

Berdir’s picture

Yes, I'm not saying it is great the way it is, and there have been issues for a long time that wanted to change it, but that is how it works now.

So, Save and unpublish is the literal action, but it is suggested that Save and unpublish (and its variants) will be confusing to the end user. If the end user knows or will intuit that Save Draft/Update Draft will apply to unpublished nodes, the changes we want to implement will be fine.

This is an interesting paragraph :)

1. The issue summary only mentions the "Save and keep published" button as confusing, only later on the other labels have been discussed as well. So there doesn't seem to be any data to back those?
2. "If the end user knows X and Y, then Z will be clear". Isn't UX exactly about avoiding that you have to know things to be able to understand the UI?

I did a quick search, and there doesn't seem to be any relevent usage of "draft" in core, so this is introducing new words that aren't used in help/documentation yet.

Not sure, but maybe this issue should be limited to the "Save and keep published", where I think "Update" is a valid replacement.

There are also technical underlying problems, that are not changed by this issue but is still relevant. Because there are various different buttons based on the current state of a node, it is very hard for a contrib module to alter them. There is an old issue open about this.

zaporylie’s picture

Status: Needs review » Reviewed & tested by the community

I've successfully applied patch #26 and really like how it keeps submit button simple and clear. I want to have it in 8.0.x, so RTBC+1

Berdir’s picture

Status: Reviewed & tested by the community » Needs review

Based on the recent dicussions, I don't think this is RTBC?

esod’s picture

FileSize
41.42 KB
37.06 KB
39.12 KB

Although there is no use of the word draft in core up until now, I vote to start using it at this time, for this case. Every other combination I try ends up leading me to difficult phrases like Save and keep published/Save and keep unpublished. Those phrases are too wordy and I expect users will be frustrated by those phrases' seeming lack of clarity.

Of note is something in comment #2

We have shied away from using "draft" I think because of worries about confusion with workflow, however I think that's the tail wagging the dog. Draft is the common nomenclature for a post that is not published.

If "Draft is the common nomenclature for a post that is not published", I think we're good with the current changes. All software, even great software, relies on the user to "know" something about the software in order to use it. So is it unrealistic to expect the user to know drafts are unpublished or is it not? I say it is not.

Anyway, here are current screenshots of the proposed changes for the sake of the discussion.

node_add







node_edit







node-edit_draft


nlisgo’s picture

@esod the latest patch should have changed 'Save draft' to 'Save as 'draft'

tkoleary’s picture

@berdir @esod

It is not reasonable for the entire burden of comprehension to be placed on the button text alone which is why I introduced reference to the DSM back in #8.

That DSM language in that coupled with the new "draft" nomenclature resolves the issue and this should be the experience of the user:

  1. "I want to save this article but I don't want to publish it yet. Let's see what options I have"
  2. clicks drop button
  3. "Oh, here's a "save draft" option, that's what I want. Drafts are not live."
  4. clicks save draft
  5. DSM:
    Draft has been saved. [Content title] is no longer published. Click "save and publish" to make this draft live. Use "make revision" if you want to keep the node published while working on a new version.
  6. "Ah, when I make a draft it's no longer live, cool. I'll finish making my changes then publish it again"

    or

  7. "Oh, when I make a draft it's no longer live. I want it to stay live while I work, I'll make a revision instead."

We should *not* use "save as draft" because, as Berdir noted, we are saving the changes to the node, not to a new version of the node and "save as" is universally understood as "keep the version from where I began editing but save the changes I just made to a new version" which is not what we do.

To the comment that "draft" is not a word we currently use, we should employ off-the-island thinking here. "Draft" is a ubiquitous and well defined term fully loaded with borrowed connotations we can rely on to guide users unfamiliar with Drupal. Once it is in core it also nudges contrib workflow solutions towards using "revision" in their nomenclature, which is what we want.

Berdir’s picture

I'm not against using "draft", that's fine with me. And it seems great when creating new content ("Save and publish" vs. "Save draft").

Use "make revision" if you want to keep the node published while working on a new version.

Unfortunately, not even that is true. [x] Create new revision is essentially "Save as", it keeps the old values around as an old revision, but the active revision of the node will be unpublished and the node will no longer be accessible for normal users.

The API supports this concept with isDefaultRevision() ( new in 8.x, this will save but not make the new values the active revision), but we don't use that in the UI/Forms, because starting so is going to open a whole bunch of new issues. For example, I really don't know what will happen if you then edit the node again. It will probably edit the active revision again and you will have no way to edit your latest revision... and so on ;)

We have "Save and publish", so why not use "... and unpublish"?

Would then look like this:
New: Save and publish (default), Save draft
Update published: Update (default), Update and unpublish
Update unpublished: Update draft (default), Update and publish

Then everything that *changes* the publication state is very clear and short enough IMHO and we use can draft to shorten some of the currently too long labels.

esod’s picture

We definitely need to change the DSM for updates. It is difficult to change the DSM for updates because currently the save() method in class NodeForm has the ability to print only one possible message for an updated node. See the relevant line of code in core/modules/node/src/NodeForm.php, line 421.

Use "make revision" if you want to keep the node published while working on a new version.

Making a "new version" is not the same as "Create new revision". New revisions don't change a node's publish status. I can see publishers wanting to work on a new version while keeping the old version published. If I'm not mistaken, that's what new nodes are for.

tkoleary’s picture

@Berdir

That still looks a bit complex to me and I'm beginning to question the value of "update" if we use "draft". The reason for suggesting update was to remove the clumsy "save and keep published" but I think save is sufficient in both cases if the other option is "save draft".

There is no difference when you save and publish a new node or when you save/update/save and keep published a published node. Presumably the language was introduced to remind the user that the node is live and will be immediately public on save, but that information is also already printed elsewhere in the UI and there is no evidence to show that users would not just know this.

Given the subtleties of this, I made paper prototypes of three different versions of this flow and hallway tested them on five users with knowledge of Drupal ranging from virtually none to advanced.

  • Even when the word "draft" was not in the prototype, when asked what would happen if the user clicked "save and unpublish" or "save" when the other option was "save and publish", three users said "it would be a draft" unprompted.
  • On flows where is said "update" instead of "save" or "save and publish" three users were confused as to what was being updated and whether or not it would be live.
  • On flows where the default changed from "save and publish" to "update" or "Save" users found the change jarring, eg. "why did it change from save and publish"?
  • Two users asked why save was needed with publish, they assumed publishing would save
  • The most experienced Drupal user thought that "Save and unpublish" saved a working draft but the original node was still live but he was the outlier
  • My takeaways from this were:
  • The word "draft" is very useful
  • The default action should not change
  • The word "unpublish" is essential for users to understand that the action takes down the live version

When changed to the following and tested on a new set of users the following language produced less confusion:

New node:
Publish
Save draft

Published node:
Publish
Save & unpublish

Draft (unpublished) node
Publish
Save draft

BUT, all users still found "save and unpublish" strange and asked why "unpublish" could not be a separate action from save. I am inclined to agree with that and I wonder if we should consider going to a button and toggle model eg.

New node:

[toggle] Published |unpublished
[button] Save

Published node:

[toggle] Published | unpublished
[button] Save

Unpublished node:

[toggle] Published | unpublished
[button] Save

Seems simpler

Berdir’s picture

Toggle/checkbox seems simple to me too, and it would solve #1901216: Modules cannot reliably enhance or alter the node form anymore along the way (that is the issue I mentioned above), as it would mean that we only have a single button that a module needs to alter.

Berdir’s picture

It is kind of funny, as it would essentially be the same as 7.x again, the published checkbox would just be more visible.

tkoleary’s picture

@Berdir Yes, it's ironic.:)

I think the lesson is that consistency is better especially in instances like this where the pattern is perhaps the most commonly used interaction in Drupal and many many users have established expectations for how it will behave.

I think if we land here it is definitely an improvement over 7 and also puts us in a place that is simpler and less ambiguous than wordpress, joomla, Adobe or Sitecore, all of which have more complicated patterns.

tkoleary’s picture

FileSize
167.95 KB

It could look like this. I prefer state to action and radios to checks here because it works better in all states of the node.

save

Status could possibly also be "Change status"

I also added cancel because it's the more common pattern, though perhaps that warrants another issue.

tkoleary’s picture

FileSize
167.35 KB

The last submitted patch, 26: change_save_and_keep-2068063-26.patch, failed testing.

disasm’s picture

Lets get the issue summary updated with before/after screenshots of the proposed layout.

brandonpost’s picture

I'm at the sprint at DrupalCon LA, and I will start working on a patch to implement the changes proposed by @tkoleary in #44 & #45. In #44, he asks whether adding a 'Cancel' button should be part of the scope for this issue. Does anyone have thoughts about this?

Berdir’s picture

+1 to the changes suggested there.

I don't think that cancel belongs here, at least not in a first iteration.

Note: With that, we might actually be able to use a widget again for the status. To get started with that, add a similar setDisplayOptions() call to the status field as the promote/sticky fields already have. The difference is that you want to use options_buttons instead of boolean_checkbox, although we probably need to work a bit on the labels. To get those, you need to set the on_label and off_label settings.

Edit: In Node::baseFieldDefinitions()

I'm in IRC if you have questions.

janaabiakar’s picture

Hi @Brandonpost, I am at the DrupalCon LA also, I am a UX/UI designer. I think it's important to add a Cancel button as suggested by @tkoleary.
People sometimes make mistakes while inputting their content and it's helpful to just hit a button to disregard all the changes that have been applied to a form.

brandonpost’s picture

@Berdir, thanks a lot for the guidance! This is taking longer than I thought it would since I'm still getting to know Drupal 8. I have to leave now to catch a flight, but I will try to work on this more this weekend.

@janaabiakar, I agree there should be a Cancel button here for the reason you gave. My question was more whether or not adding a Cancel button falls within the scope of this issue, or if a separate issue should be opened to allow for more discussion about the Cancel button. One question I have is where to send the user if they click the Cancel button. I think we would want to send the user back to wherever they came from. I'm not sure the best way to get this information in D8, if we just use $_SERVER['HTTP_REFERER'], or if there is a better way.

adamexmachina’s picture

Status: Needs review » Needs work

This issue needs work and is not yet ready for review.

adamexmachina’s picture

Status: Needs work » Needs review
adamexmachina’s picture

Issue summary: View changes
Issue tags: -Novice, -Needs issue summary update

I am removing the Novice tag from this issue because the summary has been updated and there are no more novice tasks to be completed at this time.

brandonpost’s picture

Status: Needs review » Needs work

@adamexmachina, you were right that this issue still needs work and is not ready for review.

drifter’s picture

Once you have content translation enabled, the save button's label changes to "Save and keep published (this translation)", which is even more verbose and harder to parse.

Berdir’s picture

Version: 8.0.x-dev » 8.1.x-dev
Status: Needs work » Needs review
FileSize
17.27 KB
4.24 KB

Maybe we can get this into 8.1.0?

This is a patch that uses a checkbox. That allows us to use the standard checkbox widget and is trivial to implement, for radio with options, we'd need to use the boolean field type, which is not a trivial switch to make and definitely not just a UI thing.

The downside is that this will break dozens of tests as they all use the button label. But afaik we can break tests in minor releases, so that should be OK.

Status: Needs review » Needs work

The last submitted patch, 58: node-save-published-2068063-58.patch, failed testing.

tkoleary’s picture

@Berdir

Bravo

Berdir’s picture

+++ b/core/modules/node/src/Entity/Node.php
@@ -399,11 +399,18 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
+        'weight' => 15,

The default weight should probably be higher so that it is likely to be at the end, together with the Save button, e.g. 90 or so.

Also, it requires a cache clear to update the view displays. Maybe we want an explicit update function to add the component for all node view displays explicitly.

tduong’s picture

Status: Needs work » Needs review
FileSize
33.88 KB
41.06 KB

Fixed a bunch of tests. There are still tests failing and need some more work. Hints on how to proceed are welcome! ;)

There is a test (Drupal\menu_ui\Tests\MenuNodeTest) coming from #2423153: Add menu from the editing page doesn't save the changes. I think we can remove it or revert that commit, since we don't need these 4 buttons anymore.

And the another strange test (Drupal\node\Tests\ NodeFormButtonsTest), which use an assertButtons() method that check for the dropdown buttons, which we don't have anymore. It's pretty useless asserting the same button each time, so maybe we should change this assertButtons() method or adding a new one that checks for the visibility of our new 'Published' boolean_checkbox and if it is checked or something like that, what do you think?

Status: Needs review » Needs work

The last submitted patch, 62: node-save-published-2068063-62.patch, failed testing.

tduong’s picture

Status: Needs work » Needs review
FileSize
7.11 KB
44.31 KB

Rerolled. New:

Berdir’s picture

Status: Needs review » Needs work
+++ b/core/modules/file/src/Tests/FileFieldDisplayTest.php
@@ -73,8 +73,11 @@ function testNodeDisplay() {
+      'status[value]' => TRUE,

it said keep, so explicitly setting it should not be needed.

Same for a whole bunch of others too. if it said Save and keep *, just change to Save. only if it says Save and publish or Save and unpublish, then you need to set status.

The last submitted patch, 64: node-save-published-2068063-64.patch, failed testing.

tduong’s picture

Status: Needs work » Needs review
FileSize
15.96 KB
47.14 KB

Fixed the bugs @Berdir mentioned in #65 and the remaining failing tests.

Status: Needs review » Needs work

The last submitted patch, 67: node-save-published-2068063-67.patch, failed testing.

tduong’s picture

Status: Needs work » Needs review
FileSize
22.63 KB
45.05 KB

As discussed with @Berdir:

  • I've set 'status[value]' only when is Save and unpublish,
  • removed NodeFormButtonsTest
  • and added a test verifying if a node is unpublished after editing it.
Berdir’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/node/src/Tests/NodeEditFormTest.php
    @@ -159,7 +168,7 @@ public function testNodeEditAuthoredBy() {
     
         // Save the node without making any changes.
    -    $this->drupalPostForm('node/' . $node->id() . '/edit', [], t('Save and keep published'));
    +    $this->drupalPostForm('node/' . $node->id() . '/edit', NULL, t('Save'));
         $this->nodeStorage->resetCache(array($node->id()));
         $node = $this->nodeStorage->load($node->id());
         $this->assertIdentical($this->webUser->id(), $node->getOwner()->id());
    @@ -171,7 +180,7 @@ public function testNodeEditAuthoredBy() {
    
    @@ -171,7 +180,7 @@ public function testNodeEditAuthoredBy() {
     
         // Check that saving the node without making any changes keeps the proper
         // author ID.
    -    $this->drupalPostForm('node/' . $node->id() . '/edit', [], t('Save and keep published'));
    +    $this->drupalPostForm('node/' . $node->id() . '/edit', NULL, t('Save'));
         $this->nodeStorage->resetCache(array($node->id()));
         $node = $this->nodeStorage->load($node->id());
    

    The [] to NULL chnage here is unrelated.

  2. +++ b/core/modules/node/src/Tests/NodeRevisionsUiTest.php
    @@ -72,8 +72,7 @@ function testNodeFormSaveWithoutRevision() {
    -    $edit = array();
    -    $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published'));
    +    $this->drupalPostForm('node/' . $node->id() . '/edit', NULL, t('Save'));
    

    here too.

  3. +++ b/core/modules/options/src/Tests/OptionsFieldUITest.php
    @@ -330,9 +330,9 @@ function testNodeDisplay() {
    -      $this->fieldName => '1',
    +      $this->fieldName => TRUE,
         );
    

    Also an unrelated change.

  4. +++ b/core/modules/system/src/Tests/Update/UpdatePathRC1TestBaseFilledTest.php
    @@ -122,7 +122,7 @@ public function testUpdatedSite() {
         $this->assertRaw('0.01');
    -    $this->drupalPostForm('node/8/edit', [], 'Save and keep published (this translation)');
    +    $this->drupalPostForm('node/8/edit', NULL, 'Save (this translation)');
         $this->assertResponse(200);
    
    +++ b/core/modules/system/src/Tests/Update/UpdatePathTestBaseFilledTest.php
    @@ -122,7 +122,7 @@ public function testUpdatedSite() {
         $this->assertRaw('0.01');
    -    $this->drupalPostForm('node/8/edit', [], 'Save and keep published (this translation)');
    +    $this->drupalPostForm('node/8/edit', NULL, 'Save (this translation)');
         $this->assertResponse(200);
    

    same.

  5. +++ b/core/profiles/standard/config/install/core.entity_form_display.node.article.default.yml
    @@ -58,6 +58,12 @@ content:
         third_party_settings: {  }
    +  status:
    +    type: boolean_checkbox
    +    settings:
    +      display_label: true
    +    weight: 100
    +    third_party_settings: { }
       sticky:
    

    I think we still need to write an update function for this.

    Add node_update_N (where N is bigger than the last).

    Load all form displays for nodes, add status with these settings, save.

tduong’s picture

Status: Needs work » Needs review
FileSize
3.7 KB
44.89 KB

Fixed unrelated changes. I'll added that function later.

The last submitted patch, 69: node-save-published-2068063-69.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 71: node-save-published-2068063-71.patch, failed testing.

tduong’s picture

Rerolled and added node_update_8004() in node.install

Status: Needs review » Needs work

The last submitted patch, 74: node-save-published-2068063-74.patch, failed testing.

tduong’s picture

Status: Needs work » Needs review
FileSize
1.75 KB
47.19 KB

Fixed a Save and keep published button committed from another issue, refactored node_update_8004().

Berdir’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/node/node.install
    @@ -225,13 +225,15 @@
       $query = \Drupal::entityQuery('entity_form_display')
    -    ->condition('targetEntityType', 'node');
    +    ->condition('targetEntityType', 'node')
    +    ->condition('mode', 'default');
    

    What else is there that's not default?

  2. +++ b/core/modules/node/node.install
    @@ -225,13 +225,15 @@
       foreach ($form_displays as $nid => $node) {
    -    // Assign status settings for the 'default' form mode.
    -    $form_displays
    +    $node
    

    Neither is correct. Use $form_display.

tduong’s picture

Status: Needs work » Needs review
FileSize
949 bytes
47.11 KB

Rerolled and done.

Status: Needs review » Needs work

The last submitted patch, 78: node-save-published-2068063-78.patch, failed testing.

tduong’s picture

Status: Needs work » Needs review
FileSize
486 bytes
47.16 KB

Misunderstood @Berdir's suggestion. Fixed.

Berdir’s picture

+++ b/core/modules/node/node.install
@@ -218,3 +219,25 @@ function node_update_8003() {
+  foreach ($form_displays as $id => $form_display) {
+    $form_display->setComponent('status', array(
+      'type' => 'boolean_checkbox',
+      'settings' => array(
+        'display_label' => TRUE,
+      ),
+    ))
+      ->save();

Indentation looks a bit off now. Patch looks good to me now otherwise.

Lets also update the issue summary, link to related issues that we're reverting to explain the big change in that test there.

tduong’s picture

tduong’s picture

Issue summary: View changes
xjm’s picture

@Berdir asked me to take a look at this issue in terms of whether it would be acceptable for a minor version.

Based on the nature of the change and the specific code changes (at least based on a cursory code review), this would be a good type of change to target for a minor version. It's disruptive to the node form structure (which is considered an internal API) and the user interface, which are both things we can change in minor versions per https://www.drupal.org/core/d8-allowed-changes#minor and https://www.drupal.org/core/d8-bc-policy.

The one concern I'd have is that in general we do not want to force people to adopt new UIs in minor versions -- we want to make it an opt-in for old installations and the default for new ones. "Fixing" the usability for existing sites is actually sometimes worse for UX because suddenly the existing users have to learn new patterns. (A memorable image in a DrupalCon Chicago keynote in 2011 was that it was akin to having someone come into your kitchen in the middle of the night and reorganize all your stuff for "better" kitchen usability, but that just means you suddenly no longer know where your spoons are. Before, you knew where they were, even if it was a dumb spot.) So is there any way we could sanely keep the old option without adding too much cruft? (If the answer is "no", that's not necessarily a reason not to do this, but we should at least discuss it.)

We'd want both usability and product manager signoff before committing the change. I also think it needs an upgrade path based on the config changes in there?

Thanks everyone! Usability improvements like this are great for the new minor version cycle.

xjm’s picture

Oh also, the current issue title disagrees with the issue summary and patch.

xjm’s picture

Adding a related issue from @berdir.

xjm’s picture

@swentel pointed out that node_update_8004() is in the patch, but it might still need an upgrade path test. Thanks @swentel!

tduong’s picture

Title: Change "Save and keep published" to "Update" » Change "Save and keep un-/published" buttons to a "Published" checkbox and an included "Save" button
Issue summary: View changes

Updated title and improved issue summary a little more .

Berdir’s picture

Keeping the existing behavior for existing sites would be possible but problematic.

Here's what we could do:

1. Right now, the update path ads the new status component as visible, like the default config. We could change that and hide it explicitly instead.
2. Either based on that or another, separate setting, we decide to show either the new single button or the old ones. Not sure if we need a separate setting, it doesn't really make sense to either show both (not sure what would actually win then, probably the buttons) nor neither.

However, I'm worried about the complexity that that would imply for core/contrib modules. My main reason for working on this is not the UX improvement. It's that this also results in a big DX improvement. We can for example close #1901216: Modules cannot reliably enhance or alter the node form anymore as a duplicate of this. We also no longer need any of the changes that #2423153: Add menu from the editing page doesn't save the changes introduced. A mistake that I'm sure lots of contrib and custom modules will make too.

If we keep the support for the old UI, we make that an even bigger problem and even more complicated to alter those buttons reliably for both existing and new sites. See for example https://www.drupal.org/project/override_node_options. This change *will* break that module (no matter which option we pick). But the nice thing is that the new code for it will be absolutely trivial. it just has to add two more lines to http://cgit.drupalcode.org/override_node_options/tree/override_node_opti... and can throw away all of http://cgit.drupalcode.org/override_node_options/tree/src/OverrideNodeOp.... (which is copied from core and adjusted for the new permission the module adds).

Berdir’s picture

Status: Needs review » Needs work

We can remove a bit more from NodeForm. The updateStatus() method and it's usage as an entity_builder directly above.

xjm’s picture

Issue tags: +Needs change record

Discussed with @Berdir. I think we should add a change record for this change given the impact on the user interaction and contrib.

Crell’s picture

Just a note, Workbench Moderation currently adds an arbitrary number of new alternatives to the drop-down button now. If that UI model changes, we still need to allow for an arbitrary number of additional "save and..." operations, because that's what WBM does. I'd also push back on leaving both old and new UIs intact, as that doubles the work for us to enhance that list. :-(

One of our designers suggested a select box with Save button rather than radios, as it would scale better to the potentially many transitions WBM could add.

Berdir’s picture

Select + save would I think be perfectly compatible with the proposed solution. You'd just hide the default status widget that is added for node forms, which you can easily do from the UI and instead show a widget for your own field.

yoroy’s picture

FileSize
18 KB

On the general notion of changing UI between minor versions: I don't think keeping the existing behaviour around for existing sites is a good idea. Apps update all the time on my phone, and I can still find the retweet and like buttons in the Twitter app too. It's not like we're rearranging the whole kitchen, more like swapping the knives and the spoons in the same drawer :-)

As for the proposed change, looking at the latest patch in #82 it looks like the new direction could work but the current design is not good enough yet:

The checkbox is not clearly related to the Save button, it might as well apply to the image field above. It’s a pity the radio button approach in #44 is so much more work, as it communicates a lot better what’s going on.

This is not a detailed design proposal but something like this to visually group the checkbox and the button needs to happen before we can commit this:

xjm’s picture

Thanks @yoroy, that all makes sense to me.

xjm’s picture

I wonder if we could do some sort of A/B testing for the proposed change once @yoroy's feedback is implemented, since we are reverting a previous fix that was also intended as a usability improvement?

xjm’s picture

So the previous issue also discussed several of these form element design choices.

Berdir’s picture

The problem is that Published is a widget. A user can see and move it around on the manage form display page. So we can't just add some simple CSS rules to change some spacing and add a visual separation. What if someone wants to show the checkbox below the title?

We have similar things with for example the node links, which are configurable too but by default, we show them separately in the node template and just care about shown or hidden from that UI. We could do something like that too, likely in seven.theme, where we already have a bunch of form alter for the node form. (Although I'm not a fan of that either, as it's close to impossible to customize that without a seven subtheme).

Bojhan’s picture

@xjm With our current practices/resources thats unlikely. I think whatever we decide we have to be very careful of its impact this is a 99% interface.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Bojhan’s picture

Issue tags: -Needs usability review
webchick’s picture

phenaproxima’s picture

IMHO, the Published checkbox should be treated as a normal widget -- that is, allow the site builders to move it wherever they like. But it should be defaulted to appearing immediately before the form actions. If the user explicitly moves it from there, so be it.

And to prevent it from getting lost in the chaos of the full form, I think core should provide a bit of CSS to highlight the checkbox in some way, like a light grey background for the entire widget and its wrapper. Or, if we want to get really fancy, a background color that changes depending on the state of the checkbox (red if unpublished, green if published).

webchick’s picture

From talking to Bojhan it doesn't sound like this is ready for product management sign-off yet, and is still in discussion. The issue summary makes it sound like there's an agreed-upon spec, however.

Either way, it'd be great to have a "future-looking" design that takes into account how Content Moderation options will show up in the new world order.

Berdir’s picture

@webchick: The way I understand, the only thing that content moderation would do is replace the "Published" checkbox with whatever UI it ends up using (a simple select, or some kind of bar or whatever).

I also thought that the only thing that we were blocked on here is making the published widget visual. The suggestion was to move it close to the save button and have it visually separated from the rest of the form.

That is more complicated than it sounds because this is just a standard widget. We could move it a specific place in seven, together with the buttons, but then we lose the ability for site builds to control its position (some might want to have it shown directly under the title or so?) and we also have to keep it configurable, so that it can be switched out with the content moderation widget/UI easily (which seven would also need to support). Since we have no field group concept in core, we can't easily make that configurable.

#103 has some alternative suggestions for the UI.

phenaproxima’s picture

Would it be helpful if I provided a proof-of-concept patch for #103?

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

ohthehugemanatee’s picture

I have an opinion about the bike shed, too! ;)

We are discussing 3 separate issues here, which do not have to be addressed all at once.

1) UX of a confusing button to "Save and Publish", "Save and Keep Published", etc
2) DX of a UI that limits customization, and loads it with nasty surprises like #2423153: Add menu from the editing page doesn't save the changes.
3) UX of a "published" state widget that is separate from the submit form element.

Issues 1 and 2 are very closely related, and have a simple solution: separate the "save" and "published state" form elements. That's the proposed resolution, and it seems like everyone in this thread agrees.

Issue 3 is actually a problem for all the fundamental node properties like author, revision, and datestamps. Right now these are separate fields, and we use templates and seven.theme to basically magick them into a sidebar. That's not great, and we should consider how to improve it. But we should consider how to improve it for all the fundamental node properties together.

And importantly, we don't have to improve it IN THIS ISSUE. This issue can address 1 and 2 in isolation, following the design pattern already in place for author, revision, and publish date. If we change that design pattern later (in a separate issue), that's OK.

With that in mind, yeah @phenaproxima I think it would be helpful to have a patch to address 1 and 2 per #103, following the design pattern already in place.

alexpott’s picture

One of the funny things about the current pattern is that most of the time you know you want to create a draft or update the published content before you click edit. Forcing the user to choose after is what makes this so tricky. Maybe we should put the choice of editing published node or creating a draft before the choice to edit.

dixon_’s picture

I agree with Alex. It is a little bit strange that the task of editing live content and creating a new draft is only distinguished with a checkbox on the edit form.

Should these two tasks not be a bit more separated? Perhaps separate the two tasks as two different operations, with separate links, tabs etc in the UI? One for "edit live" and one for "create new draft"?

tkoleary’s picture

@alexpott

One of the funny things about the current pattern is that most of the time you know you want to create a draft or update the published content before you click edit. Forcing the user to choose after is what makes this so tricky. Maybe we should put the choice of editing published node or creating a draft before the choice to edit.

Boom. Lateral thinking FTW!

Berdir’s picture

That's an interesting idea, but I don't think it really affects this issue, that's more something to think about for #2753717: Add select field to choose moderation state on entity forms?

If anything, then making this a simple widget instead of a complicated thing with the buttons will make it easier to conditionally hide it, be it always or just in some cases, when the user clicked on "create draft"?

anavarre’s picture

Component: node system » content_moderation.module
Berdir’s picture

Component: content_moderation.module » node system

@anavarre: This issue on its own has nothing to do with content_moderation.module. Other issues for that module depend on it, that's all.

johnchque’s picture

Duh, did the rebase for 8.2.x by mistake. Just an option we might use a fieldset for this, I added some code for still be able to move it around the form.

Status: Needs review » Needs work

The last submitted patch, 115: change_save_and_keep-2068063-115.patch, failed testing.

johnchque’s picture

Status: Needs work » Needs review
FileSize
50.33 KB

This time for 8.3.x. Kept the changes as shown in the previous screenshot.

Status: Needs review » Needs work

The last submitted patch, 117: change_save_and_keep-2068063-117.patch, failed testing.

johnchque’s picture

johnchque’s picture

Status: Needs work » Needs review
Berdir’s picture

Hm. Not sure about #108. Publication status is a critical part of the content creation workflow and it should IMHO always be visible and not be hidden away. So if we put it somewhere in the sidebar, we should basically put it in the same place as the revision fields, so that they are always visible.

But based on the UX tests we made with the blocks UI, the right sidebar was practically invisible to every single user, not sure if that's better with the node create form?

Using a fieldset to highlight it might work but then we need to work on the wording, because the screenshot looks pretty repetitive. Don't really have any good ideas, though.

Status: Needs review » Needs work

The last submitted patch, 119: change_save_and_keep-2068063-119.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review
FileSize
50.24 KB

Rerolled status is now a standard field, we need to change it.

Berdir’s picture

And here's a version for 8.2 in case anyone needs it.

hass’s picture

How should this fit into content moderation?

The last submitted patch, 123: change_save_and_keep-2068063-123.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 124: change_save_and_keep-2068063-124-8.2.patch, failed testing.

chr.fritsch’s picture

Status: Needs work » Needs review
FileSize
50.09 KB

#123could not be applied. I rerolled it

Status: Needs review » Needs work

The last submitted patch, 128: change_save_and_keep-2068063-128.patch, failed testing.

Berdir’s picture

Well, it applies I think, just has a merge-conflict that I forgot to fix :)

This fixes some tests. Not sure what to do about content_moderation now, we have a bit of a hen/egg problem it seems.

#2753717: Add select field to choose moderation state on entity forms is postponed on this, but content_moderation is messing around with the node save buttons and replacing it with its own similar pattern with a button per moderation_state.

Status: Needs review » Needs work

The last submitted patch, 130: change_save_and_keep-2068063-130.patch, failed testing.

timmillwood’s picture

Status: Needs work » Needs review
FileSize
1.16 KB
55.16 KB

This should fix the failing content_moderation test by just leaving it as a special case. We'll fix the content moderation button in #2753717: Add select field to choose moderation state on entity forms.

timmillwood’s picture

Issue tags: -Needs change record

Short and sweet change record https://www.drupal.org/node/2847274

Status: Needs review » Needs work

The last submitted patch, 132: 2068063-132.patch, failed testing.

timmillwood’s picture

Status: Needs work » Needs review
Issue tags: -Needs upgrade path tests
FileSize
2 KB
56.5 KB

Adding upgrade path test.

Status: Needs review » Needs work

The last submitted patch, 135: 2068063-135.patch, failed testing.

hass’s picture

Issue tags: +content moderation

We should discuss this first with content moderation team as this change may otherwise need to be rolled back for content moderation. Aside there may not enough test coverage as this should break content moderation I guess...

timmillwood’s picture

@hass - As the Content Moderation maintainer I am fine with this. Although you may have a point about test coverage, so tagged this for manual testing.

There is currently some code in \Drupal\content_moderation\Plugin\Field\FieldWidget\ModerationStateWidget that disables Node module's "publish" and "unpublish" buttons, maybe we should remove that from content moderation in this issue? However it could equally be done afterwards in #2753717: Add select field to choose moderation state on entity forms.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Berdir’s picture

Status: Needs work » Needs review
FileSize
56.57 KB

Reroll, simple conflict in a test.

We have been using this for more than a year now on projects and didn't have any issues. One thing I just noticed is that when you hide the checkbox (or when you just applied the patch without running the update or cache clear) then you see the new fieldset but nothing in it.

What we do need might be another UX review. An idea I had was to push it into the sidebar for seven and basically replace the current hardcoded Published/Not Published header at the top. Not sure if that is visible enough.

Status: Needs review » Needs work

The last submitted patch, 140: 2068063-140.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review
FileSize
57.1 KB
1.45 KB

This should fix the fails.

Berdir’s picture

FileSize
19.86 KB
14.62 KB

So, here is how it looks now:

My idea was to replace the static Published text with it somehow in the sidebar:

Status: Needs review » Needs work

The last submitted patch, 142: 2068063-142.patch, failed testing.

jofitz’s picture

Status: Needs work » Needs review
FileSize
57.09 KB
575 bytes

Fix the final test fail.

Status: Needs review » Needs work

The last submitted patch, 145: 2068063-145.patch, failed testing.

jofitz’s picture

Status: Needs work » Needs review

No, it's definitely passing!

timmillwood’s picture

Status: Needs review » Reviewed & tested by the community

I think it's looking pretty good.

hass’s picture

Status: Reviewed & tested by the community » Needs work

This cannot RTBC. See my comments, please.

Berdir’s picture

Your comments have been answered. content_moderation was breaking and has been fixed and has a separate issue to further improve it, which was blocked on this but now no longer is.

That said, we need to get rid of that description at the very least, as I tried to convince @timmillwood in the issue that moved the definition to a separate trait, that's why it re-appeared. I also asked @yoroy for thoughts on my screenshots and this might be a good issue to discuss in the UX meetings.

Berdir’s picture

Status: Needs work » Needs review
FileSize
353.18 KB

Auto-reroll powered by git.

Berdir’s picture

This patch is better :)

The last submitted patch, 151: 2068063-151.patch, failed testing.

Truptti’s picture

Verified the patch '2068063-151.patch' in #152, following are the observation
1.The Patch is applied successfully
2.On applying the patch 'Save and Publish' and 'Save as Unpublished' buttons are replaced and Publish checkbox, Save button,Preview button is displayed while creating a new node
3.On editing a node Publish checkbox, Save button,Preview button and Delete link is displayed.
Attached snapshot 'AfterPatch_Edit_Node.PNG' & AfterPatch_New_Node.PNG' for reference.
This can be marked as RTBC.

Truptti’s picture

Status: Needs review » Reviewed & tested by the community
yoroy’s picture

Status: Reviewed & tested by the community » Needs work

At the very least that "A boolean indicating the published state" description text has to go, it makes things harder to understand instead of helping :)

I'll review this more in depth soon, I wonder if we can be smarter about the visual styling of this.

Berdir’s picture

Yes, I've also noticed problems when you don't have access to the status or if it's configured to not show, then you get an empty publication status wrapper, that definitely looks weird.

@yoroy: Yeah, I agree that we need better visual styling, my idea is in #143 although I quickly tried that and it was surprisingly not easy to get it to where I wanted it. If you want to discuss this in a UX meeting, tell me when and I'll try to join in case there are technical questions.

ifrik’s picture

Status: Needs work » Reviewed & tested by the community

We discussed this in today's UX meeting, and found that this causes a problem when the workflow/content moderation modules are enabled.

The workflow module overrides the default publish button by adding extra statuses. And to complicate matter furthers: users can generate their own statuses, which are then also added to this drop-down button.
(Screenshot and recording to follow.)

It would be good to discuss this issue with people from the Workflow initiative, to see what could be workable solution.

ifrik’s picture

Status: Reviewed & tested by the community » Needs work
Berdir’s picture

@ifrik: Ah, looks like it already was discussed there and I missed that :) the workflow UI is changed in #2753717: Add select field to choose moderation state on entity forms to use a select instead of different buttons. What we need to figure out is in which order those issues need to happen, not sure what is easier. The workflow initiative is definitely aware of this patch and Tim actually worked on it.

another thing to test manually is content translation workflows, which also messes with those buttons.

yoroy’s picture

FileSize
27.78 KB

Video discussion: https://youtu.be/66ZoqccOYPI?t=9m52s

This does need some coordination with the Content Workflow team, because a situation like this does not look like an improvement:

yoroy’s picture

hass’s picture

@Bedir: WTF? That is exactly what I complained about in #149. Tests are also missing as this patch must fail with moderation in mind.

Berdir’s picture

Status: Needs work » Needs review
FileSize
61.74 KB
4.91 KB

As discussed, this implements field access for status field when moderation is enabled, incuding test coverage. Also fixed up the published status thing to be translated, optional and a details element not a fieldset. Still not convinced by this pattern at all, but at least it is technically working now and we have something that can properly be reviewed and discussed by the UX team.

@hass: What you said is that this should be discussed with the moderation team. It was not just discussed, @timmillwood, which is part of that team worked on this issue. And no, it doesn't fail, because the manually selected status is simply irrelevant and overriden when using moderation states. So it was technically working as expected, just resulted in a confusing UI, which is now fixed.

#2753717: Add select field to choose moderation state on entity forms will then also get rid of the dropbutton for the workflows and replace it with a simple select instead.

timmillwood’s picture

Issue tags: -Needs manual testing
  1. +++ b/core/modules/node/src/NodeForm.php
    @@ -145,35 +145,25 @@ public function form(array $form, FormStateInterface $form_state) {
    +      '#type' => 'details',
    

    I prefered this as a fieldset rather than details.

  2. +++ b/core/modules/node/src/NodeForm.php
    @@ -145,35 +145,25 @@ public function form(array $form, FormStateInterface $form_state) {
    +      '#title' => $this->t('Published status'),
    

    I wonder if "Publishing status" reads better than "Published status"

Berdir’s picture

1. fieldsets don't support #optional which is why I changed it. I don't like either fieldset or details, actually :) The labels are duplicated either way. As mentioned before, my idea is putting it in the same place as the revision checkbox/field, where we have a static string for published/unpublished right now when editing.

timmillwood’s picture

I have updated the patch to move the checkbox to the "meta" area where the <h3> Published</h3> currently is. This is done in seven.theme, so I also made it look nice without seven. Then if the status field doesn't exist or the user doesn't have access to it the old <h3> is used.

Bartik - Published node

Bartic - Unpublished node

Seven

Seven - With content moderation

Berdir’s picture

Nice. As mentioned in IRC, maybe we need a bit of styling in seven to make that bigger/more visible, lets see what the UX team thinks about it.

Also, an idea that I had is that with workflows, it might make sense if seven would display the current workflow state there and not published/unpublished, but that's obviously not something for this issue.

timmillwood’s picture

Right, adding the following to seven's CSS will change the label to have the same styling as a the old <h3> tag, I'll see what @yoroy thinks before updating the patch.

.form-item-status-value label {
    font-weight: bold;
    font-size: 1.231em;
}
kattekrab’s picture

@yoroy #156

At the very least that "A boolean indicating the published state" description text has to go, it makes things harder to understand instead of helping :)

I have an issue for that one. With a patch!!

#2849357: Remove "Published" status description to align with "Promoted" and "Sticky at top of lists"

Berdir’s picture

@kattekrab: This issue already removes the description as well and it changes the label to Published, but just for node. I would suggest we update this patch here accordingly and close yours as a duplicate.

kattekrab’s picture

Sounds good to me @Berdir - I'll do that now.

yoroy’s picture

@berdir is there a rationale for why we should consider moving the "published" checkbox to the sidebar?

Currently you can create, edit, publish, unpublish content while ignoring all the stuff in the sidebar. Moving the checkbox for publishing status to the sidebar would break that.

It's also not very comfortable to see the setting for published state move to different locations on the page depending on which modules you enable. That makes things unpredictable on a very important screen where we should strive to be consistent so that we don't undermine people's confidence.

timmillwood’s picture

@yoroy - The sidebar is only for Seven.theme, so we can move it out very easily, but by default (in Bartik for example) should it be one of the vertical tabs or just a fieldset above (or below) that?

Berdir’s picture

It was just an idea I had. The main reason is that we currently have that static info there about Published/Not Published, so I wanted to try how it looks when the checkbox is there and get your feedback on that.

I'm perfectly fine not moving it there. That said, when we don't do that, I'd rather not have a fieldset/details element at all, because that IMHO looks strange and very repetitive.. I'd rather do something in seven.theme that moves it into a common container with the save buttons so that we can have a visual separation there as you suggested a while ago.

The downside of doing anything (fieldset, moving to sidebar or save buttons) is that we break the ability for users to position the checkbox where they want it, as they can with other fields. For example, someone might want to have that checkbox directly below/above the title.

yoroy’s picture

Thanks berdir.

I'd rather do something in seven.theme that moves it into a common container with the save buttons so that we can have a visual separation there as you suggested a while ago.

yes!

The downside of doing anything (fieldset, moving to sidebar or save buttons) is that we break the ability for users to position the checkbox where they want it, as they can with other fields.

Would such a change make that *impossible* to do or would it be *more work* to make it look right when moving to another location on the page?

Berdir’s picture

Depends on where we make the change. If we do it in node.module then it is there for everyone and it is relatively easy to change it with a custom module that reverts those changes.

If we make it seven specific then another them would simply not have it, so if you have another admin theme you can dowhat you want, but if you do use seven.theme then it is very hard to undo that change as seven is the last to alter that form.

timmillwood’s picture

I'm wondering if we're best going back to the patch in #164.

Berdir’s picture

Possibly. Rerolled #164, will think about what to do with seven.

tim.plunkett’s picture

  1. +++ b/core/modules/content_moderation/content_moderation.module
    @@ -15,9 +15,12 @@
    +use Drupal\node\Plugin\views\filter\Access;
    ...
     use Drupal\node\NodeInterface;
     use Drupal\node\Plugin\Action\PublishNode;
    

    This looks out of place. Also, the module doesn't depend on node.module, is this okay?

  2. +++ b/core/modules/menu_ui/menu_ui.module
    @@ -352,11 +352,7 @@ function menu_ui_form_node_form_alter(&$form, FormStateInterface $form_state) {
    -  foreach (array_keys($form['actions']) as $action) {
    -    if ($action != 'preview' && isset($form['actions'][$action]['#type']) && $form['actions'][$action]['#type'] === 'submit') {
    -      $form['actions'][$action]['#submit'][] = 'menu_ui_form_node_form_submit';
    -    }
    -  }
    +  $form['actions']['submit']['#submit'][] = 'menu_ui_form_node_form_submit';
    

    yay!

  3. +++ b/core/modules/menu_ui/src/Tests/MenuNodeTest.php
    @@ -13,7 +13,6 @@
     class MenuNodeTest extends WebTestBase {
    -
       /**
    

    Out of scope, and also wrong

  4. +++ b/core/modules/node/node.install
    @@ -253,5 +254,28 @@ function node_update_8301() {
    +  $query = \Drupal::entityQuery('entity_form_display')
    +    ->condition('targetEntityType', 'node');
    +  $ids = $query->execute();
    ...
    +    ])
    +      ->save();
    

    Weird indentation choices.

  5. +++ b/core/modules/node/src/NodeForm.php
    @@ -183,59 +173,6 @@ protected function actions(array $form, FormStateInterface $form_state) {
    -    if ($element['submit']['#access'] && \Drupal::currentUser()->hasPermission('administer nodes')) {
    -      // isNew | prev status » default   & publish label             & unpublish label
    -      // 1     | 1           » publish   & Save and publish          & Save as unpublished
    -      // 1     | 0           » unpublish & Save and publish          & Save as unpublished
    -      // 0     | 1           » publish   & Save and keep published   & Save and unpublish
    -      // 0     | 0           » unpublish & Save and keep unpublished & Save and publish
    

    Thank goodness!

timmillwood’s picture

FileSize
1.99 KB
61.33 KB

Re-roll of #180 and fixes for items mentioned in #181.

@tim.plunkett - Re: #181.1 this is not really ok, although there are some Node specific things needed even though Content Moderation doesn't depend on Node, although this is out of scope for this issue, there are a couple of other issues looking into these things.

Status: Needs review » Needs work

The last submitted patch, 182: 2068063-182.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review
FileSize
62.02 KB
1.9 KB

Fixed that test and changed the published status label directly in the trait instead of just for node.

Munavijayalakshmi’s picture

+++ b/core/modules/book/tests/src/Functional/BookTest.php
@@ -741,8 +741,8 @@ public function testBookNavigationBlockOnUnpublishedBook() {
+    $edit = array('status[value]' => FALSE);

+++ b/core/modules/file/src/Tests/FileFieldWidgetTest.php
@@ -121,8 +121,8 @@ public function testSingleValuedWidget() {
+      $node_storage->resetCache(array($nid));

+++ b/core/modules/node/src/Entity/Node.php
@@ -405,6 +405,16 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
+    $fields['status']
+      ->setDisplayOptions('form', array(
+        'type' => 'boolean_checkbox',
+        'settings' => array(
+          'display_label' => TRUE,
+        ),
+        'weight' => 120,
+      ))

+++ b/core/modules/node/src/Tests/NodeEditFormTest.php
@@ -124,12 +124,21 @@ public function testNodeEdit() {
+    $this->nodeStorage->resetCache(array($node->id()));

use short array syntax (new coding standard).

Fixed the short array syntax error and attached new patch.

timmillwood’s picture

FileSize
1.13 KB
62.03 KB
22.5 KB

After talking about this on yesterday's UX meeting and talking with @jojototh today we came up with this solution:

The last submitted patch, 186: interdiff-2068063-186.patch, failed testing.

Berdir’s picture

I still find it a strange to have that duplicated label, the proposal back in #94 didn't have that and that looks better to me.

I would actually also suggest to move the markup into the template, we already have node-edit-form.html.twig which has three regions, then we could just display status in the footer and put the hr above in there?

timmillwood’s picture

Removed the label, like in #94. I think it seems a bit bare now.

Also moved the <hr/> to the twig template, but note, this is in classy, therefore admin themes that extend this will just get the checkbox.

I also removed the field from being display configurable because it doesn't make sense.

Berdir’s picture

It IMHO still makes sense to be configurable IMHO, you could for example hide it if you manage it somehow. And it makes sense for themes that do not extend from classy. We have similar things with e.g. the node links, which can also be moved around but they are in a fixed position in the default template.

Wrong screenshot, that still has the label?

Worth mentioning that the line will now always be there, also if access to status is denied. Not sure if that's a feature or a bug. Would be nice to have a screenshot with the default look in seven and when you are using workflows? And possibly as a user without administer nodes permission? I could also imagine that we'd want the upcoming workflows select to also show up below that line, but I guess that's something to figure out in the other issue and trickier, as it is now an always existing base field.

timmillwood’s picture

Yeh, I guess no hard in making it configurable.

Uploaded the right screenshot, but embedded the wrong one, edited.

I guess the last paragraph in #190 shows the downsides of #189 compared to #186. The patch in #186 has the <hr/> as part of the field, so if the field is removed intentionally, via a form alter, or due to permissions, the <hr/> is gone too.

timmillwood’s picture

Issue tags: +Needs usability review

Status: Needs review » Needs work

The last submitted patch, 189: 2068063-189.patch, failed testing.

Manuel Garcia’s picture

Sorry to be late to the party, here's my 2 cents when it comes to usability:

I feel that the published checkbox is a bit confusing for content authors, since publishing / unpublishing is a user action in their head. Having a button specifically for toggling the published state would be more in line with the concept of performing an action.

How about having three distinct (separate) buttons?

  1. Save
  2. Save and publish (or unpublish, depending on the current published status of the content)
  3. Preview
timmillwood’s picture

@Manuel Garcia - My only concern there is, what does "save" do? I guess it's need to be "save and keep published", "save and unpublish" as the two options, which is what we have now, but just in a drop button. So I guess we could move them out of a drop button into separate buttons.

Manuel Garcia’s picture

@timmillwood good point - yeah then doing that I think would be a clearer path for the user than having a checkbox for it in my opinion.

timmillwood’s picture

Status: Needs work » Needs review

I've been looking at what other systems do.

It seems like when I spun up a site on wordpress.com there was no way to save as unpublished, but a bit of googling seems to suggest it's possible to get "publish" and "save draft" buttons.

Joomla does pretty much what we're suggesting in #2753717: Add select field to choose moderation state on entity forms, a save button, then a select list to choose published, unpublished, archived etc.

Perch (https://grabaperch.com/features/use-bootstrap-foundation) has a "save as draft" checkbox, so I assume not checking this and clicking save will publish.

Wagtail, a django CMS by Drupal shop Torchbox (https://wagtail.io/) has a button similar to our current drop button.

Silver stripe (https://www.silverstripe.org/) has multiple buttons as @Manuel Garcia is suggesting.

Typo3, couldn't work it out.

yoroy’s picture

It's good to keep in mind that the dropbutton was introduced because earlier usability testing showed that people were unsure about what "Save" would do. This was probably for Drupal 6, where the "Published" checkbox was not close to the "Save" button, tucked away in a collapsed fieldset underneath.

I *think* with the published checkbox right above the Save button we're good and won't reintroduce that particular problem.

To recap our options:

With the individual buttons for both we will have to consider the label variations for unpublished to unpublished, published to unpublished, unpublished to published, unpublished to unpublished. And then we'd probably arrive at the forced wording we use in the dropbutton now, but with 2 very wide buttons.

jonathan1055’s picture

Been lurking here and watching this thread for ages, now its time I posted.

My opinion is that the checkbox option is by far the best:

  1. it keeps the buttons simple and short
  2. it keeps the buttons consistent - you do not have to read the changing words to work out what is going to happen
  3. everyone knows what 'save' does. It saves your work. The 'save' button is common to so many software applications
  4. after only a minimal amount of usage the checkbox will become so obvious and clear, that it will be easy to see immediately if the content is going to be published or not
  5. the checkbox will show the existing published state, so if you have not changed it you will know you are not going to alter the state. Having two buttons, one of which will change the state but both of which have 'save' in the text is asking for mistakes to happen
  6. I also like the label for 'publishing status' as shown in #186 as this emphasises the checkbox as being an important part of the form and the flow. Yes it kind of doubles the wording but that's fine for this vital piece of information

Jonathan

yoroy’s picture

yoroy’s picture

We discussed this extensively again at our UX meeting at devdays Seville (link to follow).

We concluded that we want to go for the checkbox option. Individual buttons would become potentially very long when translations are involved. In Seven theme we do show the current publishing status but in another location (top of the right sidebar). We decided for now to leave it there. Showing the current publishing status is sufficiently covered by the label of the checkbox itself.

timmillwood’s picture

So... now that's decided.

<hr/> like it?
should it be in node-edit-form.html.twig of classy or part of the form element in NodeForm.php?
If the site builder disabled the form element via "Manage form display" should the <hr/> also be removed?

tkoleary’s picture

No. It provides a clean separation for the submits which is visually helpful in all cases.

Bojhan’s picture

Thanks for the decision, sounds great! We do have to consider if this is a 8.4 thing, given that it changes a core interaction of a 99% field? It will need a big change notice.

@tkoleary I assume that you can remove the form submission element? Then I guess the HR is not needed, but I dont get the point of removing the form submussion element here :)

lauriii’s picture

Thanks @yoroy for pointing out the question on #202. I think using the node-edit-form.html.twig is sufficient. As a first step, you could add this only into Seven theme, not in Classy or Stable.

I think it is unlikely that we would like to make an exception on this one since it could potentially be disruptive. However, I will discuss with @Cottser and we will make a decision based on that.

timmillwood’s picture

FileSize
2.38 KB
62.9 KB

Making the form display configurable again as suggested in #190, and moving the <hr/> to Seven as suggested in #205.

The biggest remaining issue now is the <hr/> is still there is the field is disabled or the user doesn't have access. Is this ok? if not how do we remove it in Twig?

tkoleary’s picture

The biggest remaining issue now is the


is still there is the field is disabled or the user doesn't have access. Is this ok? if not how do we remove it in Twig?

IMO it's not a problem.

tkoleary’s picture

And BTW this may seem like a small change but this is so much better now. Many many authors will be happy.

xjm’s picture

Hm I'm less confident about that <hr> than @tkoleary. Also it should be possible to conditionally display it in Twig, no? Not sure whether that's what we want or not but it seems like we should not add unnecessary markup to the page when it's not useful. Also, are we sure we should do this with markup vs. CSS?

Agreed on #205 FWIW.

xjm’s picture

Oh and re: #204, yes, this is definitely a minor-only change (not backportable to 8.3.x after alpha IMO since it changes basically the most important UI). There is already a change record draft attached to the issue.

Bojhan’s picture

Can we not just add this in Seven?

lauriii’s picture

Issue tags: +Accessibility

Tagging for accessibility based on #209.

timmillwood’s picture

@Bojhan - what's "this"? the whole checkbox? the hr?

@xjm - displaying conditionally in Twig is beyond me, I tried {% if form.status %}<hr/>{% endif %} but that didn't seem to work. I guess form.status could be set without the field being rendered? I don't know. Maybe a CSS border top on the field might work better, then it would only appear if the field is rendered? We can have a try.

andrewmacpherson’s picture

I saw the accessibility tag was added re: #209. Is this a question about accessibility of <hr> versus a CSS border? I read the comments as far back as #188 where the separator was first introduced.

On balance, if we do go for a horizontal rule, make it a real semantic <hr>. Here's what I know about assistive tech support:

  • Screen readers can announce a <hr>, but it varies a lot.
  • Some screen readers provide a way to skip to the next separator, similar to how you can navigate by headings. JAWS and NVDA do, ChromeVox and VoiceOver do not, AFAIK.
  • You won't get these benefits from a CSS border.
  • It's possible to label a <hr>. I made a test page with HR elements labeled in various ways. I found that ChromeVox and Talkback will announce a separator, but only if it has a label. I need to test it with more screen readers. I don't know how helpful this is, what the label would say, or whether this is better than a heading.

The most pertinent comment is this one from @tkoleary in #203:

No. It provides a clean separation for the submits which is visually helpful in all cases.

I like this idea, though surely it applies to forms on all admin pages? The patch in #206 only adds a separator to the node form. Preceding the submit buttons with a separator, but just on node forms, kind of goes against the spirit (if not the letter) of WCAG SC 3.2.4 - Consistent Identification.

Bojhan’s picture

@tim Yep, the <hr>

timmillwood’s picture

@Bojhan - in #206 the <hr> was added to Seven via core/themes/seven/templates/node-edit-form.html.twig

It sounds like from #214 a <hr> is better than a CSS border top.

jonathan1055’s picture

@andrewmacpherson in #214

I like this idea, though surely it applies to forms on all admin pages? The patch in #206 only adds a separator to the node form. Preceding the submit buttons with a separator, but just on node forms, kind of goes against ...

AFAIK The <hr> is not intended to be added above the submit buttons, it is meant to be above the checkbox so that the checkbox does not get lost. The main discussion now is how to remove the <hr> when there is no checkbox. However, I agree with @tkoleary that it's not a problem if we have a horizontal rule when the checkbox is not there.

timmillwood’s picture

So even after all this discussion I think the patch in #206 might be good to go from a UX and accessibility point of view? So could do with a code review.

yoroy’s picture

Issue tags: -Needs usability review

Agreed @timmillwood

jonathan1055’s picture

Following on from @bojhan in #204

We do have to consider if this is a 8.4 thing, given that it changes a core interaction of a 99% field

and @xjm in #210

not backportable to 8.3.x

where would be the correct place to discuss how contib modules can maintain their 8.x tests to keep them passing? Many are tested at 8.3 and 8.4 continuously and simultaneously, and when this change is committed maintainers will have a choice of making their tests pass at 8.3 or 8.4 but not both. Should this be raised as a spin-off issue, not to distract from the final push to get this committed here.

timmillwood’s picture

@jonathan1055 - This will only affect browser tests, so I guess you can check if the checkbox exists or the drop button exists? But maybe worth a follow up issue.

Berdir’s picture

This has happened plenty of times already, compared to things like views schema changes, this can actually be worked around if you really want to, like looking for a certain string on the page.

But I don't think that many tests will be affected because the button label only changes for users with the "Administer content" permission, which most tests don't use I think. Simplenews is the only one I found in in a list of 110+ modules.

Of course, for a few modules like https://www.drupal.org/project/override_node_options, this will do a lot more than just break tests, it will break the actual functionality. But backend form structure is excluded from BC. And I think the good side is that it will make those modules a lot easier.

jonathan1055’s picture

Thanks @timmillwood and @Berdir. I maintain the Scheduler module (86 in list of most installed modules). We have 64 references to the 'save and ..' or 'save and keep ..' button over 13 out of our 22 test files, because Scheduler is all about altering the published/unpublished state at specified times. Thanks for the tip regarding searching for the checkbox (via xpath I guess). Also there may be scope to run some of the tests as a user without the full permissions, so they will get the same button in 8.3 and 8.4.

Overall this change is a great improvement which I am fully in favour of, and the minor complications with tests, and some modules breaking functionality temporarily is a worthwhile price to pay for the long-term benefit.

timmillwood’s picture

Status: Needs review » Needs work

It was discussed in #2753717: Add select field to choose moderation state on entity forms that if the moderation_state field is replacing the status field is should also appear below the <hr>, this is not possible with the current implementation of this patch. Therefore we need a #group which we can add things to.

timmillwood’s picture

FileSize
1.39 KB
63.04 KB

This should do the trick.

Adding a footer container to the node form, tested in Seven and Bartik, it looks the same as it always has, but means in #2753717: Add select field to choose moderation state on entity forms we should be able to put the moderation_state field in the footer container for nodes.

timmillwood’s picture

Status: Needs work » Needs review

oops, please review Testy McTestbot.

Manuel Garcia’s picture

FileSize
23.06 KB
22.86 KB

Looks good to me, here are some screenshots:
Before:
Before

After (#225 applied):
After patch 225

amit.drupal’s picture

FileSize
24.35 KB

Review Patch #225.
After Apply Patch run update.php than published checkbox display in content add page.

timmillwood’s picture

@amit.drupal your screen shot doesn't look right, @manuel's looks correct.

amit.drupal’s picture

FileSize
28.99 KB
21.9 KB

@timmillwood
Review again patch #225 on drupal 8.4.x and attach screenshot.

jonathan1055’s picture

@timmillwood re #229 I think all the screen shots look correct, Manuel Garcia's in #227 and amit.drupal's in both #228 and #230. I can't see any difference, and they all look correct and as expected.

timmillwood’s picture

@jonathan1055 - @amit.drupal's first patch in #228 has the <hr> in the before screenshot, even though it shouldn't. The before screenshot in #230 looks better, the same as @Manuel Garcia's #227.

Anyway, it looks like #228 onwards has just confused things and derailed the whole issue.

Things look good from a visual point of view, we have plenty of screenshots now, how does it look from a code point of view, does the implementation work ok? #2753717: Add select field to choose moderation state on entity forms has an example of how things can hook into this, does that work ok?

Berdir’s picture

+++ b/core/modules/node/src/NodeForm.php
@@ -102,6 +102,13 @@ public function form(array $form, FormStateInterface $form_state) {
 
+    $form['footer'] = [
+      '#type' => 'container',
+      '#weight' => 99,
+      'status' => $form['status'],
+    ];
+    unset($form['status']);

Can't you use #$form['status']['#group'] = 'footer'; ?

That should have the same effect and you don't need to actually move the status around.

#type actions has weight 100, so this should default to showing it directly above that, which is I think what we want.

timmillwood’s picture

Good spot @Berdir!

Really think we need sign off from a frontender / themer, @lauriii?

ifrik’s picture

This looks very clear and straightforward now. It also works fine for multilingual content.

amateescu’s picture

It's so nice to all that node-specific code removed! Here's a review:

  1. +++ b/core/modules/content_moderation/content_moderation.module
    @@ -176,6 +178,28 @@ function content_moderation_node_access(NodeInterface $node, $operation, Account
    +  return AccessResult::neutral();
    +
    +}
    

    Extra empty line ;)

  2. +++ b/core/modules/menu_ui/menu_ui.module
    @@ -352,11 +352,7 @@ function menu_ui_form_node_form_alter(&$form, FormStateInterface $form_state) {
    -  foreach (array_keys($form['actions']) as $action) {
    -    if ($action != 'preview' && isset($form['actions'][$action]['#type']) && $form['actions'][$action]['#type'] === 'submit') {
    -      $form['actions'][$action]['#submit'][] = 'menu_ui_form_node_form_submit';
    -    }
    -  }
    +  $form['actions']['submit']['#submit'][] = 'menu_ui_form_node_form_submit';
    

    This change doesn't seem necessary. Other modules might add some extra submit buttons there and it was kinda nice that the previous code was taking all of them into account.

  3. +++ b/core/modules/node/node.install
    @@ -246,3 +247,24 @@ function node_update_8301() {
    + * Load all form displays for nodes, add status with these settings, save.
    + */
    +function node_update_8400() {
    +  $query = \Drupal::entityQuery('entity_form_display')->condition('targetEntityType', 'node');
    +  $ids = $query->execute();
    +  $form_displays = EntityFormDisplay::loadMultiple($ids);
    +
    +  // Assign status settings for each 'node' target entity types with 'default'
    +  // form mode.
    +  foreach ($form_displays as $id => $form_display) {
    +    /** @var \Drupal\Core\Entity\Display\EntityDisplayInterface $form_display */
    +    $form_display->setComponent('status', [
    +      'type' => 'boolean_checkbox',
    +      'settings' => [
    +        'display_label' => TRUE,
    +      ],
    +    ])->save();
    +  }
    +}
    

    In hook_update_N() implementations we should deal only with straight config objects.

    If we want to use the Entity API, we need to do that in a hook_post_update_NAME() function.

  4. +++ b/core/modules/node/src/Tests/Update/NodeUpdateTest.php
    @@ -38,4 +39,29 @@ public function testPublishedEntityKey() {
    +   * Tests that the node entity form has the status checkbox.
    +   *
    +   * @see node_update_8302()
    +   */
    +  public function testStatusCheckbox() {
    

    Nice! The name of the update function needs to be updated though :P

lauriii’s picture

Status: Needs review » Needs work
FileSize
19.34 KB

The markup changes itself look good now. However, I think we probably will have to do something to ensure there is enough space on top of the separator because at the moment it looks a bit cramped with some variations.

Example:

Example

timmillwood’s picture

Status: Needs work » Needs review
FileSize
3.84 KB
62.71 KB

This should fix the items in #236.

@lauriii - What do you suggest? &nbsp;<br/> too old school?

lauriii’s picture

Maybe something simple as this would work

Manuel Garcia’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
FileSize
10.84 KB
10.46 KB
27.59 KB
10.46 KB
+++ b/core/themes/seven/templates/node-edit-form.html.twig
@@ -16,15 +16,16 @@
-        <hr/>

hurray!

Here the screenshots:

Before (page content type):

After (page content type):

Before (article content type):

After (article content type):
Only local images are allowed.

Looks good to me!

Code looks good, we've got a proper solution for FE, RTBC!

Manuel Garcia’s picture

FileSize
27.32 KB

Oops, here the proper image for After (article content type):

tstoeckler’s picture

Status: Reviewed & tested by the community » Needs work

Sorry to have to kick this back. This change is really great and I applaud all the effort being done here.

But - while generally we do not consider forms as an API - the node form in particular is different in my opinion as a lot of contrib and custom modules will alter this. Since this is a straight-up simplification I agree (and feel strongly, in fact) that we should do the change, however, I also think we should be a bit more up-front to module developers about this change.

The change record currently does not mention a change of the form structure at all, it could just as well just be changing the form labels.

Proof of how common it is to have to account for the currently weird node form is this gem in menu_ui_form_node_form_alter():

  foreach (array_keys($form['actions']) as $action) {
    if ($action != 'preview' && isset($form['actions'][$action]['#type']) && $form['actions'][$action]['#type'] === 'submit') {
      $form['actions'][$action]['#submit'][] = 'menu_ui_form_node_form_submit';
    }
  }

Since that is not actually broken by this patch I think it's fine to this in a follow-up, but with this patch this can now be very much simplified to something like

$form['actions']['submit']['#submit'][] = 'menu_ui_form_node_form_submit';

and I think we should make module developers aware of this.

amateescu’s picture

@tstoeckler, I had the exact opposite opinion in my review from #236 :)

+++ b/core/modules/node/node.post_update.php
@@ -0,0 +1,29 @@
+function node_post_update_add_status() {

+++ b/core/modules/node/src/Tests/Update/NodeUpdateTest.php
@@ -42,7 +42,7 @@ public function testPublishedEntityKey() {
+   * @see node_post_update_add_status()

Sorry for being nitpicky but "add_status" is a bit too generic, how about "configure_status_field_widget" or something like that?

tstoeckler’s picture

Ahh, sorry, missed that. Even though I tend to disagree, I'm fine with not changing Menu UI here, but do you agree that a note about this in the change notice is in order?

amateescu’s picture

Yes, definitely, the CR should explain in more detail the changes that were made here and their impact.

ifrik’s picture

I've also checked this with the Content moderation and Workflows modules enabled since these modify the Save button. This still works after the patch.

timmillwood’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
1.17 KB
63.15 KB

Updating based on #243.

I tend to agree with @amateescu about #242, and I guess we could address it in a follow up, so putting back to RTBC.

timmillwood’s picture

Updated the change record to explain the node form changes in more detail. https://www.drupal.org/node/2847274

Thanks @Manuel Garcia for the reminder.

Manuel Garcia’s picture

Thannks @timmillwood!

Interdiff on #247 looks good, we've got a proper CR now, +1 to RTBC

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 247: 2068063-247.patch, failed testing.

Berdir’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
63.24 KB

Rebased the patch, didn't apply anymore due to two moved tests:

$ diff 2068063-247.patch patches/2068063-251.patch 
110,113c110,113
< diff --git a/core/modules/content_moderation/src/Tests/ModerationStateNodeTest.php b/core/modules/content_moderation/src/Tests/ModerationStateNodeTest.php
< index 49eee6d527..4bce3a6142 100644
< --- a/core/modules/content_moderation/src/Tests/ModerationStateNodeTest.php
< +++ b/core/modules/content_moderation/src/Tests/ModerationStateNodeTest.php
---
> diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php
> index 7579afa4e6..f70226ebc9 100644
> --- a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php
> +++ b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php
123,126c123,126
< diff --git a/core/modules/content_moderation/src/Tests/ModerationStateNodeTypeTest.php b/core/modules/content_moderation/src/Tests/ModerationStateNodeTypeTest.php
< index 1911d9f2ba..592d8b02f2 100644
< --- a/core/modules/content_moderation/src/Tests/ModerationStateNodeTypeTest.php
< +++ b/core/modules/content_moderation/src/Tests/ModerationStateNodeTypeTest.php
---
> diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php
> index 8391dd0aae..6b5e167403 100644
> --- a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php
> +++ b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 251: 2068063-251.patch, failed testing.

tacituseu’s picture

Status: Needs work » Reviewed & tested by the community

Unrelated failure

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 251: 2068063-251.patch, failed testing.

Berdir’s picture

Status: Needs work » Reviewed & tested by the community

Do we have a new random test fail?

Failed twice with

fail: [Completion check] Line 271 of core/modules/views_ui/src/Tests/ExposedFormUITest.php:
The test did not complete due to a fatal error.

tacituseu’s picture

star-szr’s picture

From a frontend perspective, this looks good.

The additions to Seven are sensible and in this case leaving Classy alone seems to work out fairly reasonably. If someone has overridden the #theme for this form as Seven has done (in seven_form_node_form_alter()), they may need to adjust/override their node-edit-form.html.twig template if they want the publish checkbox to be with the form actions in the markup.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

I think that Bartik needs a bit more work. The submit buttons on chrome are really far away from the published tickbox.

Why am I talking about Bartik? There is a option that people have to display content creation forms in the main theme (and not the admin theme). This is another reason why this change is especially tricky. It's the one part of the admin front end that is really simple to configure to not display in the admin theme (it's just a tick box on admin/appearance). Therefore custom themes for sites that have content creation as one of there main flows for registered site visitors are likely to have customisations to this form both terms of form alters but also in terms of the theme itself.

Also because of the above I think the CR needs to detail better how this change impacts themers of the node add/edit form

Berdir’s picture

Agreed that we need be careful about this change, also in regards to frontend themes.

I think the 90% use case for seeing this form in the frontend theme is workflows where normal/anonymous users can create (unpublished) content, but who knows what people are doing :) At least for those users this issue shouldn't actually change anything, because they only had a single Save button before and they also will now. That's true for anyone who doesn't have administer nodes permission, although sites can have customized that as well of course.

timmillwood’s picture

FileSize
5.38 KB
3.97 KB
3.13 KB
Seven Bartik Stark

Here we have how the published checkbox looks by default after this patch has been applied. As @alexpott mentioned in #258, the submit buttons are quite far from the checkbox in Bartik. This is because Bartik sets this:

.node-form .form-wrapper {
  margin-bottom: 2em;
}

and this:

.form-actions {
  padding-top: 10px;
}

@lauriii @Cottser - What do you advise here?

timmillwood’s picture

Added an extra paragraph to the change notice.

When using the frontend theme for creating/editing content (either because selected in /admin/appearance or because of permissions) please be aware this change might affect the custom or contrib theme you're using. The markup including classes used have changed on the Node form.

Manuel Garcia’s picture

Re #258, #260:

Had a look at the problem with the checkbox in Bartik, and @timmillwood is right, here is how I see it:

  • The form-actions element for any publishable entity form needs its padding-top removed.
  • The form-wrapper for the published checkbox needs its margin-bottom removed.

Not a straight forward fix, we will probably have to add a CSS class to the published checkbox element at least.

Manuel Garcia’s picture

Status: Needs work » Needs review
FileSize
62.99 KB

Rebased as the changes to these two would not apply:

  • core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php
  • core/modules/content_moderation/tests/src/Functional/NodeAccessTest.php
Manuel Garcia’s picture

OK I just went ahead and had a go at this, trying to fix the issue with Bartik. I went the way of not disturbing the existing styles for the rest of the elements, and just removing margins for these specific fields.

Let me know what you think.
Before this patch in Bartik:

After this patch in Bartik:

vijaycs85’s picture

Manually tested the patch and working as expected:

Scenario 1: Fresh install with patch
- Installed site with patch
- created node
- Confirmed the node has publish checkbox

Scenario 2: Apply patch to existing site
- Installed site with 8.4.x
- Created two article. one in draft and one published
- Applied patch
- Ran update.php (ref: Start & In progress)
- Confirmed both nodes reflecting the publish status on checkbox.

Seven theme: Desktop | Mobile
Bartik theme: Desktop | Mobile

+1 to RTBC.

Bojhan’s picture

Status: Needs review » Reviewed & tested by the community

Following the screens this should resolve the last outstanding issue raised by Alex. I don't see any visual issues that could hamper commit, and with Berdirs comment in mind it seems safe to get this in.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 264: 2068063-264.patch, failed testing.
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

tacituseu’s picture

Status: Needs work » Reviewed & tested by the community

Unrelated failure

jonathan1055’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
63.23 KB

@tacituseu It is not an 'unrelated failure' it is part of the work done in #2851916: Expose phpcs patches to comment stream to ensure that patched code adheres to coding standards. This one line fix should be corrected. This 'use' statement has been added but is not required, so here is a patch with that entire change to node.install reversed out, but other than that it is identical to #264

jonathan1055’s picture

Status: Needs review » Reviewed & tested by the community

Patch now passes the coding standards and no new violations are added. Setting to RTBC as originally done in #265 and #266.

tacituseu’s picture

@jonathan1055: It was unrelated failure, #2857843: Random fail in Drupal\KernelTests\Core\Entity\ContentEntityChangedTest::testChanged to be exact, see https://www.drupal.org/pift-ci-job/686517.
You most likely based your comment on the re-test I've added...

tstoeckler’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/node/src/NodeForm.php
@@ -147,8 +159,6 @@ public function form(array $form, FormStateInterface $form_state) {
-    $form['#entity_builders']['update_status'] = '::updateStatus';

The updateStatus() method should be deprecated as part of this patch, as it's now always a no-op.

Also still not super happy about the hunk in menu_ui_node_form_alter() not being removed here while its test coverage in MenuNodeTest is being removed. Can we at least have a follow-up to discuss that?

Moreover, MediaForm contains the same status dance so would be nice to either handle that here directly or open a follow-up for that.

And lastly, looking at all the test changes, would be nice to list the needed changes for contrib tests that use the node form a bit more explicitly in the change notice.

Manuel Garcia’s picture

Status: Needs work » Needs review
FileSize
7.27 KB
70.31 KB

Thanks @tstoeckler!
Deprecating NodeForm::updateStatus().
Removing the status dance from Media, updating its tests, and also deprecating MediaForm::updateStatus().

I'm not sure what you mean about menu_ui_node_form_alter(), so I'll leave that to someone else at least for now :)

Manuel Garcia’s picture

error: core/modules/node/src/Tests/NodeEditFormTest.php: does not exist in index
error: core/modules/node/src/Tests/NodeFormButtonsTest.php: does not exist in index
error: core/modules/node/src/Tests/NodeTranslationUITest.php: does not exist in index

Rerolling #273 due to #2870453: Convert web tests to browser tests for node module

Manuel Garcia’s picture

OK thanks @timmillwood for explaining a bit why we should have another look at MenuNodeTest.

In this patch, instead of removing that chunk, I've changed it to check that the menu links only appear when the node is published, using the published checkbox instead of the different buttons.

tstoeckler’s picture

Thank you @Manuel Garcia! I'm fine now with the menu code and this way no follow-up is needed.

I adapted the change notice to make the required test changes more clear.

So everything I complained about above is fixed and I was about to re-RTBC this, but then noticed the following:

+++ b/core/modules/media/src/MediaForm.php
@@ -120,6 +86,9 @@ protected function actions(array $form, FormStateInterface $form_state) {
+   * @deprecated in Drupal 8.4.x, will be removed before Drupal 9.0.0.
+   *   The "Publish" button was removed.
+   *
    * @see \Drupal\media\MediaForm::form()
    */
   public function updateStatus($entity_type_id, MediaInterface $media, array $form, FormStateInterface $form_state) {

Because Media is (as of now) still considered experimental, we can actually remove this directly instead of deprecating it. For Node module we have to keep it around and deprecate it (just like the patch is currently doing), but not for Media.

On the other hand, would be really nice to get this in so not sure it makes sense to hold this up on some leftovers in an experimental, AFAICT it shouldn't be a problem in terms of release management, but not sure, so leaving at "Needs review". If we can get a quick update to remove that function that would be nice, otherwise maybe someone else is bold enough to pull the trigger.

Berdir’s picture

Now I'm confused, when did we add media to this?

We have an existing issue for that with an existing patch, so I'd prefer to keep that separate: #2863431: Change "Save and keep un-/published" buttons for media module

Manuel Garcia’s picture

Status: Needs review » Needs work

Hah you beat me to it @tstoeckler! It looks perfect, thanks. I noticed we didnt mention Media, so I've added info to the change notice about Drupal\media\MediaForm being changed.

However looking at @Berdir's comment looks like we should remove those changes from this patch, so I have reverted that change from the change notice.

I will prepare a patch shortly removing the changes from Media.

Manuel Garcia’s picture

Status: Needs work » Needs review
FileSize
6.62 KB
64.35 KB

Removing changes from media module added on #273, as per request on #277.

Berdir’s picture

Thanks. I think it makes sense to keep that separate, as @tstoeckler said, the rules on what we can deprecate/remove are different and the UI is very different, so I think that needs to be tested separately and I'd prefer to not block this issue on testing media UI.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

I tend to disagree with #277 as for usability impacting decisions our usual "piece-by-piece" approach has a degrading impact on the product, but since in this case the only other case is in an experimental module and we already have an issue, why not.

catch’s picture

+++ b/core/modules/content_moderation/tests/src/Functional/NodeAccessTest.php
@@ -60,8 +60,20 @@ protected function setUp() {
+    // Access that the status field is no longer visible.

s/Access/Assert

(fixable on commit)

Otherwise this looks good to me (and really happy to see this change, I've both been confused by the existing UI myself and seen others get confused by it) but want to give yoroy another chance to look at it just in case.

yoroy’s picture

Status: Reviewed & tested by the community » Needs work
FileSize
90.56 KB

Thanks for all the refinements. I'm really looking forward to see this committed as well. I had another look and found one visual glitch unfortunately:

On small screens the border above the checkbox and the bottom of the vertical tabs container are just a bit too close to eachother. Lets get them out of their intimate zones :-)

In the above mockup I fixed it by adding a margin-bottom of 1.5em to the container of the vertical tabs: .layout-region-node-secondary.

Otherwise this all looks and works great, so one more little fix and it's ready to go.

Manuel Garcia’s picture

Status: Needs work » Needs review
FileSize
544 bytes
64.47 KB
16.88 KB
14.06 KB

Good catch @yoroy thanks!

It occurred to me that on small screens the line separating the published checkbox from the top would not be as needed, as it is already visually separated from the tabs on top. So I went ahead and changed the latest patch so that the separating line only appears on widescreens, and made sure that the spacing is correct on both layouts. I think it looks cleaner this way, let me know what you think =)

Wide screen:
Node add form on a wide screen

Small screen:
Node add form on a small screen

Manuel Garcia’s picture

Had a brief chat with @yoroy about this, and he had already thought about this, and had decided to leave the line on small screens in order to make the separation crystal clear.

Doing this now, and switching all the new padding and margins to ems as well.

Wide screens:

Small screens:

timmillwood’s picture

Status: Needs review » Reviewed & tested by the community

#285 look as though it addresses #283, we're ready for commit.

yoroy’s picture

Thank you @Manuel Garcia for the quick turnaround on this. @larowlan wondered how this would look with contrib Workbench Moderation, I checked and the look is identical to what we see here. I'm happy with this now!

  • catch committed c53b322 on 8.4.x
    Issue #2068063 by timmillwood, Berdir, tduong, Manuel Garcia, nlisgo,...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed c53b322 and pushed to 8.4.x. Thanks!

Did my best with the issue credits, but let me know if I overlooked something, gets very difficult with #287 comments.

timmillwood’s picture

Opened a follow up #2886569: Users with just create content permission don't know publishing status as the UX is confusing for users who don't have the "Administer content" permission.

slashrsm’s picture

FileSize
66.34 KB

PAtch against 8.3.4. In case anyone needs to patch their projects.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

kbasarab’s picture

FileSize
109.3 KB

Roll against 8.3.5 for those needing it as well.

Manuel Garcia’s picture

Issue tags: +8.4.0 release notes
flocondetoile’s picture

FileSize
64.76 KB

Attached a reroll for 8.3.6, if needed

pfrenssen’s picture

Issue summary: View changes
FileSize
17.21 KB

It seems the update hook for this is not complete. This changes the base field definitions for all newly created entities, but existing entities also need to be updated.

diff --git a/core/lib/Drupal/Core/Entity/EntityPublishedTrait.php b/core/lib/Drupal/Core/Entity/EntityPublishedTrait.php
index 871aceb..59fddd5 100644
--- a/core/lib/Drupal/Core/Entity/EntityPublishedTrait.php
+++ b/core/lib/Drupal/Core/Entity/EntityPublishedTrait.php
@@ -33,8 +33,7 @@ public static function publishedBaseFieldDefinitions(EntityTypeInterface $entity
     }
 
     return [$entity_type->getKey('published') => BaseFieldDefinition::create('boolean')
-      ->setLabel(new TranslatableMarkup('Publishing status'))
-      ->setDescription(new TranslatableMarkup('A boolean indicating the published state.'))
+      ->setLabel(new TranslatableMarkup('Published'))
       ->setRevisionable(TRUE)
       ->setTranslatable(TRUE)
       ->setDefaultValue(TRUE)];

Here is how it looks now on my site after updating to 8.4.x:

edit: It is because my site has overridden this base field. If the field is not overridden it will look correct.

Berdir’s picture

@pfrenssen can you open a new issue? Note that your description is not the one from the changed code but the old one from the node module.

description/title afaik don't require an update, just a cache clear. Are you sure that your example is a node form and not something else that was copied from node? That string was already changed/removed in Node in #2810381: Add generic status field to ContentEntityBase

ressa’s picture

I just noticed the improvement in the "Publish"-UI, when I was testing the latest version (8.4.0-rc2) over at simplytest.me. Thanks for making this small, but great improvement, the new design is much more user-friendly and intuitively understandable.

gillesv’s picture

FileSize
8.05 KB

@berdir, I also experience the issue that @pfressen mentioned.

The update function worked for most node types, but NOT the "page" node type. I think it's because that node type was generated automatically by the install profile, and the site was not installed in the default english language (but in the dutch language), so it created overrides for all the basic fields (title, status, promote,...).

Should I create a new issue?

geerlingguy’s picture

Chiming in just because I had no clue this was happening until I read through the 8.4.0 release notes today... but basically, this feels like a regression to me—we had this idea of 'action buttons' with multiple actions throughout the Drupal 8 UIs, and we also had a lot of different systems (like workflow moderation) that added to or changed the button to add new items.

The published checkbox not only adds more weight to the operations on the node form, in my mind it adds some complexity in that the one button used to be my control over how a node was published, but now that ambiguity is hidden behind a checkbox (usually not styled that well by other admin themes or themes where node forms are displayed using the non-admin theme) and a save button, which was a #DrupalWTF from D7 and prior (even though it used to be slightly more hidden than it is now).

Also, for anyone who's modified anything in a node form submit button (e.g. the text of one of the buttons/actions), that code will likely break (I've only done it once, and don't have time right now to test against 8.4 on that site), so this change is not only relatively major for UX (the whole reason we switched to a Dropbutton instead of checkbox + button was as a result of UX testing/research), it also can and will break certain themes (which isn't apparent in any of the change records/notes I found).

Is... there any discussion around reverting to how it was working in 8.0-8.3?

DuaelFr’s picture

I'd add that low technical skill admins that are used to see and use this drop-down button on their sites are likely to dislike this checkbox because of our natural resistance to change.

I'll deploy one of these tomorrow. We'll see...

DamienMcKenna’s picture

My concern with the new UX is as follows:

  • The need for a UX change was identified through a usability study, which is an excellent use of data-based decision making.
  • What the widget was changed to does not seem have been made based upon any UX research, so how do we know it isn't going to come back from a future UX study to say it's worse than the 8.3.x interface?

This seems like a small dichotomy.

samuel.mortenson’s picture

I feel like this is a UX regression, even if user testing showed that the dropbutton was confusing, that's what every Drupal 8 user has become accustomed too. In my opinion this should be at least configurable, so that existing sites don't have to re-adjust to such a dramatic change.

LiamPower’s picture

I don't really agree with how this has been done, I'm going to have clients who I'm sure aren't going to be happy with the change to their content editing experience. I feel this should have been a configuration option within the content types to allow a preference to be made.

Sam152’s picture

I think a minimal contrib module to restore the old behavior will address this. I don't have an opinion on the UX, but I also have some particular sites that will need to remain consistent with 8.3.

Berdir’s picture

I understand that not everyone is happy with the change, also simply because it is a change. Maybe a configurable module can restore the behavior, but making it configurable in core would be quite complicated. Keep in mind that this doesn't just affect the standard node form but also content moderation which was changed to basically replace the checkbox with a select instead of lots of dropbox options. Then all those things would have to respect that setting and we'd have twice the code complexity and this was already extremely hard to get in as it is.

Note that those dropbuttons are by default only visible for users with "administer nodes" permission, which is an administrative permission that normal users on many sites won't/shouldn't have, for them, nothing changes.

This also considerably simplifies altering the node form, allowing normal users to publish/unpublish content can now be done with 3 lines of hook_entity_field_access() code and allow access to the status field but not changing other things like author/created/sticky/new revision behavior. And I've seen various questions on Drupal Answers where people were struggling with altering the node form because you had to add your action to all buttons but then again special casing preview and so on. Now there is always only one button.

geerlingguy’s picture

I opened #2914426: Revert the removal of the entity save dropbutton in Drupal 8.4.0 as a follow-up since this ticket is closed.

xeM8VfDh’s picture

I'm not here for the the dropdown vs checkbox debate. But, this change did cause some confusion in my org because the checkbox above "Save" has no corresponding "Published" label, as showing in the original patch screen shot. Am I missing something, or might there be some configuration that is preventing the "Published" label to show next to the checkbox above the "Save" button? Right now its just a mysterious checkbox above the "Save" button, so it's not immediately apparent that to save-as-unpublished, the editor should uncheck that box.

maybe my issue is related to this... https://www.drupal.org/node/2915879

It looks like a problem with content types migrated from D6 to D8, but the issue linked above doesn't clearly explain how the issue was resolved. If anyone knows, please share!

EDIT: it looks like, as a result of my D6 to D8 migration, I had various entried like the following (see below) for my content types created in D6:

core.base_field_override.node.<CONTENT-TYPE>.promote
core.base_field_override.node.<CONTENT-TYPE>.status
core.base_field_override.node.<CONTENT-TYPE>.sticky

and corresponding config files:

sites/default/config/core.base_field_override.node.<CONTENT-TYPE>.promote.yml
sites/default/config/core.base_field_override.node.<CONTENT-TYPE>.status.yml
sites/default/config/core.base_field_override.node.<CONTENT-TYPE>.sticky.ym

I deleted the config files, which showed differences queued for synchronization in Configuration >> Development >> Configuration Synchronization. I then ran the synchronize option on that page, and it removed the entries from my database. As a result, I now see the proper "Published" label on "Manage form display" pages and on the create/edit content type pages. So, I think this solves the problem, but am hesitant to push changes to production.... does anyone know if this is safe?

EDIT: allegedly these config changes are safe (see: https://www.drupal.org/node/2915879#comment-12313531)

fdverwoerd’s picture

FileSize
21.87 KB

I'm not sure if I should make new issue or say it here, but when upgrading from 8.3.7 to 8.4.2 the save button has not changed, see attached screenshot:

'Save and keep upublished' or 'Save and publish' do not work, but these buttons are still present?

JHDiamond’s picture

Hey!! What if we turn the whole thing into something like an 80's adventure story game?! something like:

Dear user, you have just traveled down the road of working on your content. As you start to think about hanging your metaphorical hat up and resting your weary eyes, you suddenly approach a fork in the road! Bahhhumbug! Now what do you do?! Luckily, there is a dwarf standing at the fork. As you approach, they ask "Hello noble content creator. The hour is late and the time to rest is nearing. You have just one critical decision to make and your options are thus: Do you wish to make your content visible to the world now with all the changes and additions and toils you've put into it this day and all days preceding this day since the creation of this content object? Do you wish to discard the work you've done, forever losing the time you've put into it and ceeding the story to the lost sagas of manhood's forgotten past? Or Do you wish to save the work but not show it yet to the publish, knowing that you will work on it another time? Choose wisely good fellow. The night approaches fast!"

And then like, you have to click on the right sentence or something but its not hyperlinked to indicate that that's what your supposed to do.

Thoughts? I think all content creators would really appreciate it it!