You are here

function simplenews_scheduler_menu in Simplenews Scheduler 5

Same name and namespace in other branches
  1. 6.2 simplenews_scheduler.module \simplenews_scheduler_menu()
  2. 6 simplenews_scheduler.module \simplenews_scheduler_menu()
  3. 7 simplenews_scheduler.module \simplenews_scheduler_menu()

File

./simplenews_scheduler.module, line 16

Code

function simplenews_scheduler_menu($may_cache) {
  $items = array();
  if (arg(0) == 'node' && is_numeric(arg(1))) {
    $node = node_load(arg(1));
    $snid = false;

    // use this for the original node or any editions of the node
    if ($node->simplenews_scheduler) {
      $snid = arg(1);
    }
    if ($node->simplenews_scheduler_edition) {
      $snid = $node->simplenews_scheduler_edition['snid'];
    }
    if ($snid) {

      // workflow exists for this type
      $items[] = array(
        'path' => "node/{$node->nid}/simplenews_scheduler",
        'title' => t('Scheduled Newsletter'),
        'access' => user_access('manage simplenews node schedules'),
        'type' => MENU_LOCAL_TASK,
        'weight' => 2,
        'callback' => 'simplenews_scheduler_node_page',
        'callback arguments' => $snid,
      );
    }
  }

  /**
   * Always load simplenews_schedulerr_views.inc when views module is present
   */
  if (module_exists('views')) {
    include_once drupal_get_path('module', 'simplenews_scheduler') . '/simplenews_scheduler_views.inc';
  }
  return $items;
}