Problem/Motivation

When using content moderation module, editors are unable to order children if the node is in draft revision.

Steps to reproduce

  1. Install standard profile
  2. Install entity_hierarchy and content_moderation
  3. Enable the default workflow for the basic page
  4. Add a parent field to the basic page
  5. Create a few nodes in hierarchy, all published
  6. Check the /node/TOPNID/children - looks ok.
  7. Create a new version of top page in draft
  8. Check the /node/TOPNID/children - unable to order the children (there are none shown).
  9. Publish the top page
  10. Check the /node/TOPNID/children - looks ok again.

Proposed resolution

I'm still getting my head around how EH works with revisions (eg the moveChildren() method that is called on entity update). I guess there is a case for being able to order the children of the current published version OR the latest draft version. In any case, having no children showing creates a lot of uncertainty for editors.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

sime created an issue. See original summary.

larowlan’s picture

This is expected behaviour

The forward revision is not the parent at that stage, the published one is

I will need to think about how to handle this without changes being visible on the live site

sime’s picture

In addition to ordering the children of the live revision, our editors want to work on batches of changes of a whole tree in draft mode, which includes ordering the children in the draft view.

In the short term I'm going to add a warning explaining why they can't see any children.

You need to publish this page in order to access the children ordering form.

I'm wondering if we need a content staging environment for these big changes.

sime’s picture

I just realised, I think they have no way of ordering children of the live page if there is a currently draft in progress.

sam152’s picture

In addition to ordering the children of the live revision, our editors want to work on batches of changes of a whole tree in draft mode, which includes ordering the children in the draft view.

Hey @sime, just to clarify, when you say "in draft mode", do you mean when the parent content is being drafted, or do you mean creating a draft version of the whole entity hierarchy and then publishing that once it's ready?

sam152’s picture

Status: Active » Needs review
StatusFileSize
new810 bytes

Putting aside #4 and #5 and purely looking at the steps in the issue summary, you can choose to load the default revision in that reorder form, which does indeed grant you access to reorder the tree, while creating a draft.

I'm not sure if this impacts other areas of EH, but conceptually I guess it would be modifying the "live" version of the tree, like @larowlan mentioned in #2. I'm unsure what users expectations are at that stage, considering they are mid-way through a draft or if "leaking" into the live version is useful or not.

Seeing what the bot says.

sam152’s picture

Just trying to clarify my own understanding of the module and the problem space (please correct me if I'm wrong):

  • Each node has a parent field.
  • The parent fields of a group of nodes together create the hierarchy.
  • The hierarchy is revision aware, because you can draft a node and re-parent the draft (to be later published).
  • The parent field is standard field storage, stored in a revision alongside all other page content.
  • The re-order form is required to modify revisions of children, to set the weight, so the reordering works.
  • So conceptually, the draft of a parent has no relationship to the hierarchy created by the revisions of children, the reorder form kind of gives that impression, but under the hood, it's reaching into a child revision and resaving it (see #3188383: Reordering children overrides their drafts).

I do wonder if given this information, it's conceptually possible to "draft" tree reorder changes and have that be independent of child content changes, without a massive amount of complexity. I do wonder if storing the tree information in a field is going to afford this level of flexibility.

Conceptually, maybe a "reorder" operation needs to direct users into the child entity form to make changes. From there, they are already presented with options around drafts and publishing, so decisions about when things are reflected in the live version would be more explicit.

This does introduce a massive limitation, that reordering and reparenting are stuck and bound to content changes that might be occurring at the same time. This is unsolved in core and was once in scope for the workflow initiative. The issue tracking such revision semantics is: #3023194: [PP-2] Add parallel revisioning support:

The typical example is an entity going through a set of significant changes (either via Workspaces or via an editorial workflow implemented via Content Moderation) and at the same time needing a small typo fix in its default revision.

In this case the "typo" that the parent entity wants to fix up is the weight of the child.

sime’s picture

> Hey @sime, just to clarify, when you say "in draft mode", do you mean when the parent content is being drafted

In this specific issue it's just the parent that is in draft.

> you can choose to load the default revision in that reorder form.

I'm not sure how to do that. is there a route like /node/20/children/vid/12345?

I'm a bit confused because following the steps in the OP, I can't find any way to order the existing children of any revision if there is a draft - node/20/chilren just shows empty. A lot of your comments Sam suggest that it's a nuanced thing, but I think if there was only one version of the children that might be fine - but I can't apparently interact with it at all if there is a new draft.

> Conceptually, maybe a "reorder" operation needs to direct users into the child entity form to make changes. From there, they are already presented with options around drafts and publishing, ...

I understand the complexity but I didn't realise this issue went so deep :D

sime’s picture

Oh i missed that there is a patch. Trying it.

sime’s picture

Status: Needs review » Reviewed & tested by the community

The patch fixes the immediate problem for us! I'm going to add an editor message saying "This order applies to the current version of the page (which is usually the published version), you can't control the order for draft versions".

Do you want us to write a test?

sime’s picture

Assigned: Unassigned » sime
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new5.95 KB

  • larowlan committed a453498 on 8.x-2.x authored by sime
    Issue #3188021 by sime, Sam152, larowlan: Re-order children...
larowlan’s picture

Status: Needs review » Fixed

Thanks, rolling 8.x-2.25

Status: Fixed » Closed (fixed)

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