Problem/Motivation

The node form is not validated/submitted if the workbench_moderation module is enabled and configured along with the Gutenberg settings on.

Steps to reproduce

Consider the Basic page for this case,

  1. Enable the "Gutenberg" for the "Basic page" content type
  2. Download and install workbench and workbench_moderation
  3. Enable the Moderation for "Basic Page" with the default settings.
  4. Now open a form to add the content of type "Basic page" (node/add/page)
  5. Click on any Moderation state button. With the default setup, edit page will have three "Moderation state" for the user 1, They are listed as follows,
    • Save and Create New Draft
    • Save and Request Review
    • Save and Publish
  6. There will be no validation + no submission

Proposed resolution

The ninja hacks added to stop form to submission as every button in Gutenberg will cause the submit event.
For this to handle, I propose use of the drupalSettings library and adding/updating the submit action element with the "id" attribute. This way, the other modules which add the action buttons to the node form will share those ids vai hook_page_attachments_alter() implementation.
e.g.

/**
* Implements hook_page_attachments_alter().
*/
function workbench_moderation_page_attachments_alter(array &$page) {
$options = ['edit-submitted', 'edit-draft'];
$page['#attached']['drupalSettings']['gutenberg']['nodeActions'] = $options;
}

And the gutenberg.js will capture these, and the form will functions as expected.

Issue fork gutenberg-3221238

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rahul.shinde created an issue. See original summary.

rahul.shinde’s picture

Issue summary: View changes
rahul.shinde’s picture

Issue summary: View changes

rahul.shinde’s picture

Assigned: rahul.shinde » Unassigned
Status: Active » Needs review
rahul.shinde’s picture

Title: The node form is not validated/submitted if the workbench_moderation module is enabled and configured along with the Gutenberg settings on. » The node form is not validated/submitted if the workbench_moderation module is enabled and configured along with the Gutenberg.
codebymikey’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#3185886: Support various submit action buttons

This appears to be a duplicate of #3185886: Support various submit action buttons