Problem/Motivation

Buttons disappear on entity forms when entities that are moderated are embedded in that form using inline_entity_form. I'm not sure if the fix should be in content_moderation or inline entity form at this stage.

Proposed resolution

TBD.

Remaining tasks

TBD.

User interface changes

TBD.

API changes

TBD.

Data model changes

TBD.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sam152 created an issue. See original summary.

Sam152’s picture

The offending function is \Drupal\content_moderation\Plugin\Field\FieldWidget\ModerationStateWidget::processActions. Not sure what the fix looks like at this stage.

Sam152’s picture

I don't expect this patch to make it in, it obviously has IEF specific fixes in it. Possibly IEF could override the widget class an make it work with it's own submit buttons. Or maybe the approach content moderation takes to render it's widget could be more explicit/configurable/robust so IEF specific fixes aren't required.

Hosting the patch here for my own reference and possibly a work around while this is addressed properly.

Sam152’s picture

Status: Active » Needs review

Just for the test bot.

Sam152’s picture

Status: Needs review » Needs work
Sam152’s picture

Title: content_moderation alters buttons on the parent entity when a moderated entity is embedded with inline entity form » Make content_moderation and inline_entity_form place nice
Sam152’s picture

Title: Make content_moderation and inline_entity_form place nice » Make content_moderation and inline_entity_form play nice
timmillwood’s picture

I've never used inline_entity_form so hard for me to comment, but we don't really want to add inline_entity_form specific changes in core.

I think we either need a generic way of making it work, or make the change in inline_entity_form itself.

dawehner’s picture

There is one issue which wants to remove the little dropbutton we have for the publish/unpublish field, and instead provide an additional checkbox or so. I cannot find that particular issue at the moment, but when we would agree on that interaction pattern, content_moderation would not have to alter the submit button.

timmillwood’s picture

Issue tags: +Workflow Initiative

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.

darol100’s picture

@Sam152 Great patch, something I notice is that when I am editing a draft of a node does not bring the draft version of the entity reference. Instead it bring the published of the entity_reference.

In my current use case this is a problem. I am not sure if this will be an expected behavior or if this should be even fix as part of this issue. What you folks think ?

Sam152’s picture

Inline entity form doesn't imply a composite relationship. You would need entity reference revisions for that. I've only tested this in the context of the inner entity being moderated and the parent not.

ansitun’s picture

Patch #2 will not be applicable to all entity references and their children as well (recursively) for a content type. I have create a patch that allows to have support for entity reference recursively, meaning that if there is an entity reference inside of another entity reference this will still add support of content moderation with inline edit form.

timmillwood’s picture

Status: Needs work » Needs review
+++ b/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php
@@ -169,11 +170,37 @@ public static function updateStatus($entity_type_id, ContentEntityInterface $ent
+    ¶
...
+    ¶

Spaces introduced.

timmillwood’s picture

Status: Needs review » Needs work

Back to needs work.

darol100’s picture

These patches seem to be outdated in 8.3.x. Instead having the states button, I am getting some weird auto-complete field.

Dinesh18’s picture

Fixed the white-space errors as per #17. Here is the updated patch.

Dinesh18’s picture

Status: Needs work » Needs review
amateescu’s picture

Status: Needs review » Closed (duplicate)
darol100’s picture

Status: Closed (duplicate) » Needs review

Please ignore my comment from #17, that issue was unrelated to this patch.

@amateescu, I read issue #2753717: Add select field to choose moderation state on entity forms and it seem to be solving a different issue. This is temporary support for inline editing form. Just like @Sam152 mention on #3 this patch will never make it into core. For this reason, I am moving this patch into "Needs Review" so we can continue supporting this temporary solution until inline_editing_form support content_moderation.

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.

timmillwood’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php
    @@ -165,11 +166,37 @@ public static function updateStatus($entity_type_id, ContentEntityInterface $ent
       public static function processActions($element, FormStateInterface $form_state, array &$form) {
    

    The widget has changed so much, we don't have processActions() anymore.

  2. +++ b/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php
    @@ -165,11 +166,37 @@ public static function updateStatus($entity_type_id, ContentEntityInterface $ent
    +    // Get the part of the form which contains the entity being moderated.Ø
    

    Don't need the 'Ø'.

timmillwood’s picture

Status: Needs work » Closed (outdated)