Adding Custom Fields to Publish Step

Use the following hook implementation to add custom fields to publish step It also supports validation.

Usage:

add_filter( "owf_display_publish_custom_fields", "append_custom_fields", 10, 3 );

Parameters:

$task_user : current task user id
$process_type : Process type i.e publish

Example:

add_filter( "owf_display_publish_custom_fields", "append_custom_fields", 10, 3 );

function append_custom_fields( $task_user, $process_type, $html ) {
   if( $process_type == "publish" ) {
      $html = '<div class="owf-text-info left full-width"><div class="left"><label>'.__("Custom checklist: ", "oasisworkflow").'</label></div>';
      $html .= '<div class="left">';
      $html .= '<label><input type="checkbox" name="spellcheck" id="addtags" /> Did you run the spell check? </label>';
      $html .= '<label><input type="checkbox" name="addtags" id="addcategories" />Did you add tags? </label>';
      $html .= '</div></div>';
      return $html;
   } 
}
custom attributes on the last step

2. Validate added custom fields or add code for out of the box action / process.

Usage:

add_action( 'owf_sign_off_workflow_pre', 'validate_custom_fields', 10, 2 );

Parameters:

$validation_result : Empty array / Array with existing validation
$sign_off_workflow_param : contains workflow publish step submitted values

Example:

add_action( 'owf_sign_off_workflow_pre', 'validate_custom_fields', 10, 2 );

function validate_custom_fields( $validation_result, $sign_off_workflow_params ) {
  // Do validation or add out of the box action or process code.
   if( isset( $sign_off_workflow_params['addtags'] ) &&  $sign_off_workflow_params['post_tag'] < 5  ) {
      $validation_result = array_merge( $validation_result, array("There must be at least 5 post tags") );
   }
   return $validation_result;
}