craftcms / craftcms/docs

[4.0.0-beta.1] Replacements for 'cp.entries.edit.details' hook and draftEditor.on('createProvisionalDraft') js event

Open
#346 3 comments 1 reaction 1 assignee View on GitHub

@mattstein is already working on this.

Since Mar 11, 2022.

Bug
Dominant language
JavaScript
Stars
42
Forks
160
Avg merge
3h 9m
Merged PRs (30d)
4

Description

Description

Not really a bug, but maybe some missing info in the upgrade guides.

Upgrading plugins/modules went very smoothly so far, just one thing i couldn't figure out in entries edit pages:

In 3.7, we are adding custom buttons to the end of the sidebar via the now removed hook cp.entries.edit.details.

image

Could only find the Element::EVENT_DEFINE_SIDEBAR_HTML event, which places the added html somewhere in the middle of the sidebar. Is there a possibility/event to add the html to the very end of the sidebar?

The compare button is hidden by default in 'Current' entries, and gets enabled when a provisional draft is created:

window.draftEditor.on('createProvisionalDraft', function() {
    newDraftId = window.draftEditor.settings.draftId
    ...
     $('#draft-new').css('display', '')
});

This obviously does not work anymore, is there another js event we could hook into that gets fired when a provisional draft is created and contains the new draftId?

(If not, this is a FR :-)

Additional info
  • Craft version: 4.0.x-dev
  • PHP version: 8.0.15
  • Database driver & version:
  • Plugins & versions: none

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.