You are here

function workbench_scheduler_node_load in Workbench Scheduler 7

Same name and namespace in other branches
  1. 7.2 workbench_scheduler.module \workbench_scheduler_node_load()

Implements hook_node_load().

File

./workbench_scheduler.module, line 179
Content scheduling for Workbench.

Code

function workbench_scheduler_node_load($nodes, $types) {

  // Are there any node types that have schedules setup?
  if ($scheduled_types = workbench_scheduler_get_types()) {

    // Any of these nodes match those types?
    if (count(array_intersect($scheduled_types, $types))) {

      // Fetch schedule data for each node based on nid & vid.
      foreach ($nodes as $nid => &$node) {

        // Is this node one of the scheduled types?
        if (in_array($node->type, $scheduled_types)) {

          // Fetch the scheduled data for this node.
          if ($schedule = workbench_scheduler_load_node_schedule($nid, $node->vid)) {
            $node->workbench_schedule = $schedule;
          }
        }
      }
    }
  }
}