fromholdio/silverstripe-schedulable 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fromholdio/silverstripe-schedulable

最新稳定版本:2.0.0

Composer 安装命令:

composer require fromholdio/silverstripe-schedulable

包简介

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

README 文档

README

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

(See branch 1.x for Silverstripe 4 & 5 support.)

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

统计信息

  • 总下载量: 850
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-04-25