Module Monday: Custom Publishing Options

All Drupal content types inherit a few basic flags that can be used to control their behavior. Is this piece of content published? Is it promoted to the front page? Is it 'sticky,' and bumped at the top of lists it appears in? Those are all useful, but complex sites inevitably need more (or different) flags to control the behavior of content in complex designs and workflows. Fortunately, the Custom Publishing Options module can fill the gap.















Screenshot of administration screen

As one might guess from the name, site builders can use the module to add custom publishing options to any content type. These options are simple boolean flags (like 'breaking news' or 'not for syndication') that appear alongside Drupal's default publishing options on node edit forms. These flags can then be used to filter and sort content in custom Views, and the setup information can be captured in exported Feature module configuration collections for easier reuse and deployment.















Screenshot of resulting change to site

In theory, site builders can duplicate this functionality using boolean FieldAPI fields. That approach requires additional tweaking to avoid the displaying the flags as part of the node's actual content, however, and can be tricky to layer on top of already-existing content types in a Feature. Custom Publishing Options also takes the unorthodox step of adding its flags to the standard node table in the database, rather than a separate side table. While tweaking the node table directly is rarely a good idea, this module does it the "right" way, implementing the hook_schema_alter() function to ensure that all other Drupal modules are aware of its modifications. If you're looking to add simple flags to your content and want to ensure that they're stored and treated just like the "core" publishing options, check out Custom Publishing Options.

Get in touch with us

Tell us about your project or drop us a line. We'd love to hear from you!