This project is not covered by Drupal’s security advisory policy.
The Cronpub module is fundamentally created with one purpose; time-based publication and un-publication of content entities. It also manages the flags ‘sticky’ and ‘promote’ and custom plugins.
The distinctive feature of Cronpub, compared to e.g. Scheduler, is that it offers editors a serial date function that makes repeated publishing and unpublishing in any desired time interval a breeze. The plugin interface of the Cronpub module allows to run any kind of time controlled action on entities (not just publish/unpublish).
This is achieved with relevant PHP iCalendar libraries that manage the full functional range of iCal recurring events (ICAL, RRULE), following the RFC 5545 Internet Calendaring and Scheduling Core Object Specification (http://tools.ietf.org/html/rfc5545#section-3.3.10)
Field of application
The tool is useful for serial publishing of any sort of recurring events, episodes or content, for example of a series of radio programmes, or a series of news articles or stories or levels of a quiz or a contest, in short anything that should be published in date / time intervals, for example every second Saturday of the month from March 1 to Oktober 1, 2017.
The Cronpub module can be used with any fieldable content entity (nodes, terms, custom content entities), as the CronJob functions are added to entities as a field and a widget, in which start and end dates and the recurrence rules (when, for how long and how often) are entered. All operations (e.g. publish/unpublish) are automatically executed on the parent entity (the entity with the Cronpub field).
Because not all custom entities have the same ‘base fields’ (status, sticky, promoted to front page), the entity type(s) on which the Cronpub module is applied should be considered. The functionality described here can only be guaranteed for use with nodes.
A custom content entity may not be published and unpublished automatically, because it may not have a status field and a status value that CronJob can set. The CronJob module provides a submodule, cronpub_published, that adds a ‘status’ field type in the field UI, and thus the possibility to make any custom content entity publishable and unpublishable.
Providing a serial event function for content entity operations is the core function of the Cronpub module. The kind of operation is of secondary importance, as the Cronpub module provides a plugin interface, through which any sort of operation may be carried out on content entities (beyond (un)publish, make (not) sticky and (don’t) promote to front page). Developing new plugins for the Cronpub module is very simple, because the interface only demands two methods, the ‘start-action’ and the ‘end-action’. These methods define what should happen with an entity at the start and at the end of an event (time range). The file cronpub/src/Plugin/Cronpub/Action/CronpubSticky.php may serve as a template for creating custom plugins. The definition of the plugin in the machine-readable code comment above the PHP class must be adapted. Particularly, a unique ID must be set. Otherwise, it will break. The fields of a custom plugin will be available in the Cronpub widget as soon as the plugin is found in a suitable module path (e.g. cool_module\src\Plugin\Cronpub\Action).
- Install cronpub by composer, so that the required PHP library simshaun/recurr is available by autoloader.
- Enable the cronpub module.
- While the Libraries API is not stable in D8.x, please download: https://github.com/jkbrzt/rrule/archive/v2.1.0.zip and place the contained files in the top level libraries folder, so that the files rrule.js an nlp.js can be reached under
DRUPAL_ROOT /libraries/rrule/lib/rrule.js DRUPAL_ROOT /libraries/rrule/lib/nlp.js
You will have to unpack the library and rename the main folder from rrule-2.1.0 to rrule.
- Go to status page and check for warnings from Cronpub module if the library was found.
- Add a Cronpub date field to your content type.
- Go to form display page of your node type and select the ICal rrule.js widget (recommended).
- Make sure your cronjob is configured to run several times per hour.
- This module requires Shaun Simmons Recurr lib (on Github https://github.com/simshaun/recurr) as PHP-Library to generate Cronpub-Tasks from an ICal RRULE
- The CronpubRruleJsWidget makes use of the comfortable JS Library rrule.js by Jakub Roztocil and Lars Schöning (on Github https://github.com/jkbrzt/rrule) to convert human-readable rules into valid RRULE strings.
Thank you very much for making this module possible.
- Maintenance status: Actively maintained
- Development status: Under active development
- Module categories: Content Access Control, Content Display, Event, Fields, Rules
- Reported installs: 1 site currently reports using this module. View usage statistics.
- Downloads: 94
- Last modified: October 9, 2016
- This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.