Skip to content
This module adds embargo/expiry scheduling to your data objects and site tree.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
_config
src
.editorconfig
CHANGELOG.md
CONTRIBUTING.md
LICENSE
README.md
composer.json

README.md

silverstripe-schedulable

This module adds embargo/expiry scheduling to your data objects and site tree.

Also adds a GridFieldScheduledStatus component, allowing you to display the scheduled status of an object within your GridField.

Requirements

Installation

composer require fromholdio/silverstripe-schedulable

Details & Usage

It's essentially plug-n-play - just apply the Schedulable extension to your DataObject or SiteTree class.

It works by augmenting the regular sql query and including/excluding records based on their embargo/expiry settings. This doesn't apply if stage=Stage and your user has VIEW_DRAFT_CONTENT permission, or if you're within an Admin controller.

Works with Versioned objects, when objects are embargoed or expired for the current date on the active Versioned stage, they will not be returned in your queries.

Provides some additional accessors:

  • IsScheduleEmbargoed() = true if object is embargoed (becomes false once the embargo date/time is passed)
  • IsScheduleExpired() = true if object has expired (false until the expiry date/time is reached)
  • WillScheduleExpire() = true if object is not currently embargoed, and will expired, but has not yet
  • getScheduleStatusLabel() = returns a human readable description of current status (e.g. "Embargoed until 01/01/2020 12:00:00")

If an object has both an embargo-until date/time, and an expiry date/time, getScheduleStatusLabel() will reflect the most relevant current state. (So, in that case, it will return that it is Embargoed Until X, and once that date/time passes, it will change to Will Expire At Y.)

Example of applying the extension to SiteTree class:

---
Name: extensions
---
SilverStripe\CMS\Model\SiteTree:
  extensions:
    - Fromholdio\Schedulable\Extensions\Schedulable

To Do

  • Better docs
You can’t perform that action at this time.