Problem/Motivation

Workspaces core adds validation handlers that prevent submission of any form that is not explicitly marked as safe via code from within a workspace. That also means that every time that an editor/site administrator needs to submit a form inside a workspace, a developer needs to mark the form as safe via code first, before forms can actually get submitted.

As discussed with Fabianx and amateescu, WSE should make this a bit easier by not denying form submission by default but rather prompting and warning the submitting user that the submissions happens inside a workspace.

Proposed resolution

When a form is submitted inside a workspace and not explicitly whitelisted on the settings form, a prompt asking the user for confirmation of the submission inside the workspace pops up and submission of the form happens only after hitting the confirmation button.

Certain forms may be whitelisted to not show the prompt. This happens via entering form ids on the WSE settings form. Further, some workspaces internal forms are hardcoded to never use the prompt as it doesn't make sense in this case.

Issue fork wse-3304460

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

s_leu created an issue. See original summary.

s_leu’s picture

Status: Active » Needs review
wroxbox’s picture

This patch adds a button but the UI is not working:
two buttons

Clicking save leads to drupal error, internal error.

Clicking the left blue buttton opens a dialog:
Open dialog

But the save leads to drupal internal error and nothing is saved.

Seems that the markup for the button actually is not final:
Markup for the save button

amateescu’s picture

Status: Needs review » Needs work

Thanks for testing! Setting this to NW.

s_leu’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new2.39 MB

Ok I think this is ready for review again. The current code should work on all config forms now and it also supports switching to live and then back into the workspace the submission was triggered in.

According to my tests, there was just one problem: When submitting the "Manage form display" or "Manage display" forms, it appears as the changed values are saved. But refreshing the page after saving it from within a workspace, the changes are not loaded resp. it looks like they never get saved. Here a screencast that may make it more clear:

I didn't invest much time to dig into this problem yet as I'm not sure if it's better to just ignore these forms and mark them as exceptions which will have to be submitted in the live workspace. Any thoughts on this?

amateescu’s picture

Status: Needs review » Fixed

Committed a few code cleanups and merged the MR into 1.0.x, thanks for all the work on this!

Status: Fixed » Closed (fixed)

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