You are here

function scheduler_test_scheduler_allow_publishing in Scheduler 7

Implements hook_scheduler_allow_publishing().

File

tests/modules/scheduler_test.module, line 27
Main functions and hook implementations of the Scheduler Test module.

Code

function scheduler_test_scheduler_allow_publishing($node) {

  // Only publish nodes that have the 'Approved for publication by the CEO'
  // checkbox ticked.
  $items = field_get_items('node', $node, 'field_scheduler_test_approved');
  $allowed = !empty($items[0]['value']);

  // If publication is denied then inform the user why.
  if (!$allowed) {
    drupal_set_message(t('The content will only be published after approval by the CEO.'), 'status', FALSE);
  }
  return $allowed;
}