Draft/Publish/Preview Interface (input helper)

Version 1.2 added 1 year ago by scottnath

HOW TO INSTALL: To install this package, copy the following code and paste it into your Pods >> Package Manager under the Import tab and follow instructions there.

1.2 Notes

fixed a bug where multiple previewPodForm's would show up.

About this Package

The draft/publish/preview interface helper creates a box in the upper-right hand corner of pods forms that is meant to mimic the functionality found in the posts and pages forms. Some notes to make this work:

1) The column machine name must be "draft_publish"

2) The column type must be "boolean"

3) For draft to properly work (ie not show on pod pages) you will need either a sql call inside the 'findRecords' code:
$record->findRecords('created DESC', -1, '`draft_publish`!=1');
or you can put it inside your own code:
$draft_publish = $pod_list->get_field('draft_publish');
if($draft_publish){
continue;
}

4) In order for preview to work, you need a page template in your theme named "Pod Preview"
/**
* Template Name: Pod Preview
*
*/

5) The "Pod Preview" template must contain the Pod code and necessary HTML code to show a preview