[6.x]: No way for custom element types to add top level buttons in toolbar or beside the Save menu
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 15/100
Research direction
Start with ElementEditorActions::buttonActions() and the ElementEditorPayloadResolving hook, which the issue says only ever wire buttons to submitAction(), and with the payload.previewTargets path used for the toolbar's View links. The open question is the API design: how a plugin can declare a non-submitting link, download or modal button for the toolbar or beside Save. Done means a maintainer-agreed extension point, not a patch, so check for a decision in the thread before writing code.
Written by the indexing model from the issue text.
Description
What happened?
The legacy editor rendered getAdditionalButtons() / additionalButtonsHtml() beside Save, which in Craft 5 sat in the page header, so these buttons were prominent at the top of the edit page. On the Inertia elements/Edit page:
editorActions.buttons(beside Save in the footer) is built from core actions (Create a draft, Apply draft, etc.) inElementEditorActions::buttonActions(). Plugins can append to it viaElementEditorPayloadResolving, but every button is wired tosubmitAction(), so it submits the editor's form. That suits save variants, not links, downloads or modals.- The toolbar's "View" links come from
payload.previewTargets. They're front-end URLs that also feed Live Preview, so they're not a fit for CP links.
There doesn't appear to be a way to add a non-submitting button (link, download, or modal) to the toolbar or beside Save, other than preview targets.
As a workaround, I've currently added previous custom plugin buttons that lived in these locations to the ⋯ action menu via extraActionMenuDescriptors(), but they're less discoverable there.
Craft CMS version
6.0.0-alpha.20
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 11h 54m
- Merged PRs (30d)
- 251
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from craftcms/cms
-
[6.x]: AdminTable not available for plugin index and settings screensPossibly taken @brianjhanson claimed this today. Openbug repo:cms
craftcms/cms#19912 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
bug repo:cms
Difficulty 4/5 3-5 days Newbie friendliness 30/100
craftcms/cms#19911 · 1 comment ·
Maintainers usually reply within 1 day
-
bug repo:cms
Difficulty 4/5 3-5 days Newbie friendliness 22/100
craftcms/cms#19909 · 1 comment ·
Maintainers usually reply within 1 day
-
[6.x]: UI API doesn't appear to have a scoped container Node to nest a component's settingsUi() under a pathPossibly taken @riasvdv claimed this today. Openbug repo:cms
craftcms/cms#19908 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
[6.x] Licence nag countdown never continues to the control panel, and there's no button to skip itPossibly taken @brandonkelly claimed this 1 day ago. Openbug repo:cms
Difficulty 3/5 1-2 days Newbie friendliness 55/100
craftcms/cms#19895 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
hawk-digital-environments/HAWKI#443 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100