Add Publish Validation

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

I initially submitted this as a GitHub issue: Add publish validation (No DataObject validation on publish) · Issue #2487 · silverstripe/silverstripe-cms · GitHub

Submitting here since the issue was closed.

Problem

CMS users often begin building pages and other pieces of the site before having all the content. I’d like to allow them to save a draft while they gather the remaining pieces, but prevent publication unless it’s complete.

Say this is a layout block with a text field and an image, and it will look broken without the image. Currently I can do one of three things:

  1. prevent them from saving without the image, meaning they will have to enter the text again once they have tracked down an appropriate image.
  2. I can allow them to publish without the image and just not display the block until they add one
  3. I can allow them to publish and display a broken block.

Option 1 makes my CMS users complain so I inevitably end up at 2, which confuses them because they don’t get told the image is required but they don’t see the text they’ve entered on the live page. If they complain loudly enough about that I can give them option 3, but then since they still aren’t getting validation messages they end up putting broken layouts live.

Solution

I would like to see Publish validation. If fields were incomplete or incorrect the CMS user would be allowed to save, but they would see notifications that they are unable to publish and what needed doing before publish.