Opened 8 years ago
Closed 8 years ago
#42206 closed defect (bug) (fixed)
Customize: Facilitate including changeset title with save requests
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.9 | Priority: | normal |
| Severity: | normal | Version: | 4.7 |
| Component: | Customize | Keywords: | has-patch |
| Focuses: | Cc: |
Description
Allowing users to set the title of a Customize changeset is useful on sites that enable both changeset branching and a post list table for saved changesets. However, there's currently no "official" way to control the title of a changeset submitted with the 'customize_save' Ajax request.
Unofficially, one workaround is to replace the default "Save" button with a custom button that provides more control over what happens when the user saves their changes. But the default "Save" button's added powers in 4.9 makes replacing it less feasible.
As discussed in Slack, one way to provide more control over the title is to trigger an event before sending the 'customize_save' request, which is the approach I've tried in the attached patch.
Another idea from the Slack discussion was adding a changesetTitle state. I decided to try the event first because (a) managing the state adds a lot of overhead for a feature with no core UI now, (b) a future core UI for the title might benefit from some other approach than a changesetTitle state, and (c) an event might scale more easily to future changeset parameters that also don't have a core UI.
I named the event 'customize-save' for consistency with the Ajax action. 'save-data' was suggested in Slack, but I decided against it because the PHP filter by that name passes parameters that seem closer to the existing 'changeset-save' event. Of course, the name could be anything.
Attachments (4)
Change History (8)
#1
@
8 years ago
- Milestone changed from Awaiting Review to 4.9
- Owner set to westonruter
- Status changed from new to accepted
- Type changed from enhancement to defect (bug)
#2
@
8 years ago
42206.2.diff switches to 'save-data'.
#3
@
8 years ago
Thinking about this some more, and now I'm thinking save-params would be a better name because otherwise save-data could be confused with the customize_changeset_data param. See 42206.3.diff.
This will be needed by the Customize Snapshots plugin when adding support for 4.9. The plugin will need to add the title field, but as noted in this ticket, there would not be a clean way to ensure this title is included in the save requests.
I think
save-datawill be a better name ultimately becausecustomize-saveis redundant in that it's being triggered on thewp.customizeobject already. The reason the Ajax action is prefixed bycustomizeis because it is in the global scope.