Search by

purplespider / silverstripe-elemental-draft-lock

purplespider

Lets editors lock an individual Elemental block as draft, so publishing the page does not publish it

Package info

github.com/purplespider/silverstripe-elemental-draft-lock

Type:silverstripe-vendormodule

pkg:composer/purplespider/silverstripe-elemental-draft-lock

Statistics

Installs: 7

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.2.0 2026-10-02 15:32 UTC

This package is auto-updated.

Last update: 2026-10-02 15:47:04 UTC


README

Stops a page publish from accidentally publishing blocks that were meant to stay in draft.

Screenshot 2026-10-02 at 16 45 34@2x Screenshot 2026-10-02 at 12 57 47@2x

The problem

In Elemental, publishing a page publishes every draft block on it.

Say a page has a couple of blocks deliberately left unpublished: a new section still being written, or one taken down for now. Later someone fixes a typo elsewhere on the page and clicks Publish without thinking. Every one of those draft blocks goes live, and there is no record of which blocks were in draft beforehand, so no easy way to put things back.

The fix

Switch on Lock as Draft for a block, and publishing the page leaves it in draft.

  • The switch sits in the block's header, beside its ... menu, while the block is expanded and still in draft. Blocks that are not edited inline have it in the action bar of their own edit screen instead. It saves straight away, so there is no need to save the block or page after.
  • Locked blocks show a padlock on their status badge in the block list.
  • A notice below the block list shows which blocks are locked, and which draft blocks will go live with the page.
  • To publish a locked block, use Publish in its own ... menu, or publish them all at once with Publish page and locked blocks in the page's ... menu.

Once a block is live it is no longer held, so later edits go live with the page as normal.

Installation

composer require purplespider/silverstripe-elemental-draft-lock

Then run dev/build?flush=1.

Configuration

All optional, and all off by default apart from enabled:

PurpleSpider\ElementalDraftLock\DraftLock:
  # Switch the module off for a site without removing it
  enabled: true
  # New blocks start locked, so nothing new goes live until it is unlocked or published on its own
  lock_new_blocks: false
  # Lock a block when it is unpublished from its own menu, so the next page publish keeps it off
  lock_on_unpublish: false

Known limitation

Files used by a locked block, such as an image, are still published with the page. The block stays off the site, but the file itself is reachable at its own URL.

Requirements

  • Silverstripe CMS 5
  • dnadesign/silverstripe-elemental 5

Licence

BSD-3-Clause