Problem/Motivation

Following on from #2490136: Enable revisions by default we should remove this option from the node form altogether, for the following reasons:

Proposed resolution

Remove the checkbox.

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

catch created an issue. See original summary.

catch’s picture

timmillwood’s picture

This is highly dependent on #2490136: Enable revisions by default, once that gets committed I'll write the patch for this.

catch’s picture

Status: Active » Postponed

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.

catch’s picture

Status: Postponed » Active
Issue tags: +Needs product manager review

Re-opening and tagging.

timmillwood’s picture

Issue tags: +Workflow Initiative

I think this belongs in "Workflow Initiative", also noticed that 5 months ago I promised to write the patch, I re-add it to the todo list.

dawehner’s picture

What will happen with the revision log field? I guess it would simply stay where it is?

catch’s picture

I think so.

I did wonder about introducing the concept of minor revision (which wikipedia had the last time I made an edit on there about 5 years ago, not sure about now).

That's subjective of course, but creating a new revision or not is also subjective.

This minor vs. not could then be used in the revision/diff UI and potentially for pruning old revisions. However not sure that has to be in core at all.

imalabya’s picture

Status: Active » Needs review
FileSize
1.56 KB

Added an initial patch for removing the checkbox and save the revisions by default. I guess it needs test.

Status: Needs review » Needs work

The last submitted patch, 10: 2696555.patch, failed testing.

tstoeckler’s picture

  1. +++ b/core/modules/node/src/NodeForm.php
    @@ -317,16 +309,11 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
    +    // If a new revision is created, save the current user as revision author.
    

    This comment is out of date. Maybe we can just add "and set the current user as the revision author." to the previous comment

  2. +++ b/core/modules/node/src/NodeForm.php
    @@ -317,16 +309,11 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
    +    $node->setRevisionCreationTime(REQUEST_TIME);
    

    This should now use \Drupal::time() since we're changing it here anyway. Changing it to inject the dependencies would be out of scope IMO, but this change should be fine.

Berdir’s picture

Copy & paste of my comment in #2669802-50: Add a content entity form which allows to set revisions

I'm not 100% convinced yet. I think there are sites that might want to give users a choice. Especially with translations and so on, there are IMHO valid use cases to avoid saving new revisions.

From that issue:

The decision to save new revisions or not is a site building or developer issue, not a content author one.
Maybe, but why don't we let the site builder/developer decide what they want to allow?

Note that at least for nodes, you already need administrative permissions to change the default (which means you can also publish/unpublish, change author, ...), so this permission already exists to allow them that kind of control. But it is global. We could add another setting to the node type to control if the setting should be enforced or not?

Based on a short discussion in IRC with @catch, I provided another reason why a setting would make sense to me: We can add that any time in 8.x, we could even default it to TRUE (enforce setting) for new node types as long as we force it to FALSE in an update function for existing ones.

That allows sites that want to enforce this to do it now, and we can still see if we want to remove that setting again in 9.x and enforce it (while still allowing form alters or so to change it I suppose). Maybe those examples that I have in mind (like fixing a typo in the default revision while other changes are being worked on in forward/draft revisions or translation related things) will not longer be valid when we have improved UI's, workspaces and so on (Where users don't have to chose between creating a revision or not but between saving and saving as draft/other workflow state or something).

catch’s picture

I'd be +1 to a setting, defaulting to on everywhere.

I think nearly all the cases Berdir brings up could at minimum be solved by creating a new revision and deleting the previous revision. Just doing this would be preferable to overwriting an individual revision since at least then we've reduced one code path (the specific code path which caused untold problems in 7.x).

seanB’s picture

I agree that site builders at least should have a choice to enable the checkbox for authors. Not sure about the default setting? Maybe UX people can comment on that.

yoroy’s picture

Issue tags: +Needs screenshots

Are we talking node form only or "everywhere" and if the latter, what does that mean? :)

seanB’s picture

It would be nice if we have a consistent UX for all revisionable entity types. For now I think it's just node and block content in core.

catch’s picture

@yoroy so we'd add a setting, probably at the bundle or entity level, which controls whether the checkbox is shown. The idea being we add a setting for site builders in return for losing a checkbox on the node form. In 9.x we could remove both UIs altogether but this lets us improve the defaults with the smallest amount of change for existing sites.

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.

yoroy’s picture

I agree that this is more of a site builder task to implement what's probably a *business* decision (about governance, compliance etc.) of whether to expose revision checkboxes to content authors. I think the default should be "on" so that it provides a kind of safety net for content changes.

geek-merlin’s picture

Title: Remove the option to create a new revision or not from the node form » On the node form, make "create new revision" and "revision log" configurable
Related issues: +#2811549: Hide "Revision log message" field on Node add form

If i get it right the consensus here is (#13):
> We could add another setting to the node type to control if the [create new revision] setting should be enforced or not?

Setting title accordingly.

Also we have other related issues about (see related):
* Should the "revision log" field be provided
* Should (Add new revision | Revision log) be available on node-create or only on edit
(We can reasonably assume that "show on create but not on edit" does not make sense.

My feeling is that rather than splitting this into 2^n issues, let's handle this here "once and for all"(TM).

timmillwood’s picture

Issue tags: -Needs screenshots

Sounds like a plan, thanks @axel.rutz

geek-merlin’s picture

So when we want to configure
* Should the "revision log" field be provided
* Should (Add new revision | Revision log) be available on node-create or only on edit

...and we have these means of configuring:
* node type form
* form mode fields
* permissions

...i'd propose to do it like this:
* Make Override if a revision is created for node type foo a permission (which prevents the Add new revision checkbox)
* Make Add new revision and Revision log fields configurable per form-display. This opens the possibility to have them on one form mode and not the other.
* Make Show 'Add new revision' and 'Revision log' also on node create (not only on node edit) form" a setting per node type

geek-merlin’s picture

Berdir’s picture

We already changed a while ago to not show the revision on node create, that's not up for discussion. A setting simply doesn't make sense because a new entity is always a new revision. In the past the setting was shown but was not relevant.

We currently already have a permission to control if the checkbox can be changed or not, that's administer nodes. While splitting that up would be useful, I don't think it belongs in this issue.

IMHO, this is really just about introducing a setting whether the new revision checkbox should not be visible at all, even for users with that permission. I disagree that trying to do multiple things here will make it easier to get it done, usually those kind of issues get stuck in discussions forever.

timmillwood’s picture

I think on the content type edit form (/admin/structure/types/manage/article), maybe under "publishing options" we first remove the "Create new revision" checkbox. Then add checkboxes for "allow content authors to choose if a new revision is created", "allow content authors to add a revision log"

The create new revision checkbox should never show up on a new node form, because a new node will always be a new revision, but I think the revision log field should be shown on new and existing nodes.

Berdir’s picture

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

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

mlncn’s picture

The contrib solution to the original request (remove the checkbox) is Hide Revision Field: https://www.drupal.org/project/hide_revision_field

Its respectable usage statistics, despite being harder to find than this issue, indicates interest in removing this clutter from the authoring experience.

+1 to always doing revisions and hiding the log message textarea by default (or even letting contrib add it back)

Version: 8.5.x-dev » 8.6.x-dev

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

matsbla’s picture

I created this issue #2978701: Replace the revision log message with a comment field. I'm not sure if this is a solution for this issue, but if revision log messages were a comment field site builders could at least decide what comment fields are mandatory or if all fields in the revision log will be hidden. So it will give site builders a lot of possibilities to configure the behavior they want.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

seanB’s picture

Title: On the node form, make "create new revision" and "revision log" configurable » On the entity form of revisionable entities, make "create new revision" and "revision log" configurable

Let's make sure this is consistently solved for all revisionable entity types.

Pancho’s picture

Priority: Normal » Major

The fact that a D8-only contrib module has more than thousand installs points to this being a major UI annoyance or, as the contrib maintainer says, "noise."

The decision to save new revisions or not is a site building or developer issue, not a content author one.

Full ACK.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

chr.fritsch’s picture

Status: Needs work » Needs review
FileSize
662 bytes

What about making that "revision log" configurable by form display?

Status: Needs review » Needs work

The last submitted patch, 36: 2696555-36.patch, failed testing. View results

jonathanshaw’s picture

What about making that "revision log" configurable by form display?

I love the idea in principle, but we need to handle its relationship with the "Create new revision" checkbox.

chr.fritsch’s picture

Do we really have a relation?

So what we could create is an extra field "Create new revision" that appears on all the form displays, next to "Revision log message".

In that case, the site builders have the maximum freedom.

As an alternative, we could create an extra field "Revision information" that combines the checkbox and the log message.

jonathanshaw’s picture

Do we really have a relation?

If per #26 we persist in having a checkbox to "allow content authors to choose if a new revision is created" then
1. we should only show/enable the revision log field if they check that
2. we would likely want to place the revision log immediately under that checkbox

So what we could create is an extra field "Create new revision" that appears on all the form displays, next to "Revision log message".

As an alternative, we could create an extra field "Revision information" that combines the checkbox and the log message.

Extra fields don't have settings so with extra fields along we wouldn't have the ability for the sitebuilder to force the creation of new revisions but allow the editor to give a log message, or for the sitebuilder to allow the editor to choose whether a revision is created but not allow the editor to give a log message?

How about either:

A: Create depends on log
1) Create a bundle setting "Always create new revision"
2) Make the revision log form display configurable as you suggested in #36
3) If the setting "Always create new revision" is false, then create a new revision only if there is a log message

B: Use a widget
This is how the contrib module does it.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

playful’s picture

Is there any update on this? I have recently created a site that allows users to register and post job announcements. On the job content type edit page I have unchecked the box to create a new revision, and this successfully removes that field from the create new node form. But the revision field remains on the edit node form, and it seems impossible to remove. That is a field that my users do not need to see and it seems crazy this wouldn't be configurable by the site builder.

There are configurable permissions to delete revisions, revert revisions, and view revisions... Why not simply make a permission for user roles to create revisions? When unchecked for a certain user role, the revision field would not display on node add/edit forms for the content type.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

manuel.adan’s picture

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

lauriii’s picture

Looks like something has changed and the "Create new revision" is now visible even for users who don't have the administer nodes permission. Filed issue for that: #3384520: "Create new revision" is overridable regardless of permissions.