Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 298712

Add support for Quick Edit to the Content Moderation module

$
0
0

Problem/Motivation

At the moment, Content Moderation and Quick Edit are incompatible. If users are viewing a moderated entity, Quick Edit is only available on the default revision, which goes against Content Moderation's workflow of always editing the live revision. This can lead to tricky problems and bugs.

For example, enable moderation on an entity bundle, publish a draft, then create a new draft of that entity. If you visit the default (published) revision and use Quick Edit, the draft is discarded as Quick Edit is only aware of the default revision of any given Entity! This is really confusing for content editors (and may be considered a bug).

Proposed resolution

There are a number of steps that need to happen to make these modules work together:

  1. Use the EntityRevisionConverter to pass the correct Entity revision to Quick Edit paths, in the same way Content Moderation currently handles Entity Forms.
  2. Ensure that Contextual Links display on the latest revision of a Node. Otherwise Quick Edit will be inaccessible to users.
  3. Make sure that the ModerationStateWidget does not interfere with Quick Edit operations.
  4. Disable Quick Edit on non-latest and live revisions of moderated entities.

Remaining tasks

Review the provided patch.

User interface changes

None.

API changes

Quick Edit routes provided by inline editors will need to set the route option "quickedit_entity_route: TRUE" so that Content Moderation knows to swap what revision is provided for moderated Entities. This was an explicit way to add this support, as Quick Edit routes are not required to share any similarities and the alternative would be to hard-code routes (see my Workbench Moderation patch from #2749503: Add basic support for Quick Edit).

\Drupal\content_moderation\Entity\Handler\ModerationHandlerInterface will get a new method, entityViewAlter, which will allow handlers to perform modifications on a built moderated entity. This is used by \Drupal\content_moderation\Entity\Handler\NodeModerationHandler to disable Quick Edit on individual revisions and ensure that contextual links on the latest (non-default) revision are rendered normally (typically non-default revisions of Nodes have different contextual links).

Data model changes

None.


Viewing all articles
Browse latest Browse all 298712

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>