Skip to content

Detect if a draft for a new entry is being created in save hook #10370

Answered by brandonkelly
MoritzLost asked this question in Ideas
Discussion options

You must be logged in to vote

I’m not sure what you’re looking for actually exists… Craft doesn’t let you create a new entry and a new draft for it at the exact same time. Entries will always start in one of these states:

  • As a full-fledged entry, when created via the Quick Post widget or an entry editor slideout (which you can identify via $event->isNew && $event->sender->firstSave).
  • As an unpublished draft, when created via the “New entry” button on the Entries index page (which you’ve indeed found out how to identify – or you could check $event->isNew && $event->sender->getIsUnpublishedDraft()).

In neither case will an additional draft be created right off the bat, though.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@MoritzLost
Comment options

@brandonkelly
Comment options

@MoritzLost
Comment options

Answer selected by MoritzLost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants