Repository: plone/Products.CMFPlone

Issue:
Can't edit the modal property of an action in Plone UI
Most settings of actions can be edited in the actions control panel in the Plone UI. See the classic demo:
https://6-classic.demo.plone.org/@@actions-controlpanel

Some actions have a modal property, for example the `object_buttons/delete` action. You can see it in the ZMI:
https://6-classic.demo.plone.org/portal_actions/object_buttons/delete/manage_propertiesForm
The property value is this:

```
{"actionOptions": {"disableAjaxFormSubmit":true, "redirectOnResponse":true}}
```

It would be nice if this could also be edited in the control panel.  Currently this property is now shown at all.
I guess there could be other non-standard properties as well, so bonus points if this shows all properties.

My use case today was actually on Plone 5.2 where I wanted to change the modal property of `user/login`. In Plone 6.0.0 this is an empty dictionary, but on 5.2 it was this:

```
{"prependContent": ".portalMessage", "title": "Log in", "width": "26em", "actionOptions": {"redirectOnResponse": true}}
```

I had to change the width to 18em in a client project today because their base font size was a lot bigger, which led to the login modal being only half visible on mobile. :-)

With my release manager hat on: no I don't want this changed in 5.2, people will have to use the ZMI there. Depending on scale and impact of the needed changes, a fix for this could be done either in a 6.0.x bugfix release, or in 6.1.


Discussion:

Resolving patch:
diff --git a/Products/CMFPlone/controlpanel/browser/actions.py b/Products/CMFPlone/controlpanel/browser/actions.py
--- a/Products/CMFPlone/controlpanel/browser/actions.py
+++ b/Products/CMFPlone/controlpanel/browser/actions.py
@@ -1,6 +1,7 @@
 from plone.autoform.form import AutoExtensibleForm
 from plone.base.interfaces import IActionSchema
 from plone.base.interfaces import INewActionSchema
+from plone.base.utils import base_hasattr
 from Products.CMFCore.ActionInformation import Action
 from Products.CMFCore.interfaces import IAction
 from Products.CMFCore.interfaces import IActionCategory
@@ -14,6 +15,8 @@
 from zope.interface import implementer
 from zope.lifecycleevent import ObjectCreatedEvent
 
+import json
+
 
 class ActionListControlPanel(BrowserView):
     """Control panel for the portal actions."""
@@ -163,6 +166,22 @@ def set_position(self, value):
 
     position = property(get_position, set_position)
 
+    def get_modal(self):
+        return self.context.modal
+
+    def set_modal(self, value):
+        # This property may not exist yet on the context.
+        if not self.context.hasProperty("modal"):
+            if base_hasattr(self.context, "modal"):
+                # We cannot define a property when an attribute with the same
+                # name already exists.
+                delattr(self.context, "modal")
+            self.context._setProperty('modal', value, 'string')
+        else:
+            self.context._setPropValue('modal', value)
+
+    modal = property(get_modal, set_modal)
+
 
 class ActionControlPanel(AutoExtensibleForm, form.EditForm):
     """A form to edit a portal action."""


Test patch: