You are here

function workbench_scheduler_get_types in Workbench Scheduler 7

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

Retrieve a list of all the content types associated to schedules.

Return value

mixed Returns a boolean FALSE or array of associated types.

2 calls to workbench_scheduler_get_types()
workbench_scheduler_manage_schedules_access_check in ./workbench_scheduler.module
Access callback to see if current node type allows schedules.
workbench_scheduler_node_load in ./workbench_scheduler.module
Implements hook_node_load().

File

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

Code

function workbench_scheduler_get_types() {
  $types =& drupal_static(__FUNCTION__);
  if (!isset($types)) {

    // Build select query to retrieve all distinct content types,
    // In the workbench_scheduler_types table.
    $types_query = db_select('workbench_scheduler_types', 'wst')
      ->fields('wst', array(
      'type',
    ))
      ->distinct()
      ->execute();

    // If query returns results, build an array.
    if ($types_query
      ->rowCount()) {
      foreach ($types_query as $type) {
        $types[] = $type->type;
      }
    }
  }
  return $types;
}