You are here

function ultimate_cron_menu in Ultimate Cron 7.2

Same name and namespace in other branches
  1. 8 ultimate_cron.module \ultimate_cron_menu()
  2. 6 ultimate_cron.module \ultimate_cron_menu()
  3. 7 ultimate_cron.module \ultimate_cron_menu()

Implements hook_menu().

File

./ultimate_cron.module, line 857

Code

function ultimate_cron_menu() {
  $items = array();

  // Poormans cron trigger.
  $items['admin/config/system/cron/poorman'] = array(
    'title' => 'Poormans cron',
    'description' => 'Trigger poormans cron',
    'page callback' => 'ultimate_cron_poorman_page',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
    'file' => 'ultimate_cron.poorman.inc',
  );
  ctools_include('plugins');

  // In case a plugin has been removed, we need to clear the plugin cache
  // first, so cTools won't try to include non-existant files.
  $plugin_types = ctools_plugin_get_plugin_type_info(TRUE);

  // Create callbacks for all plugins.
  $weight = 0;
  foreach ($plugin_types['ultimate_cron'] as $plugin_type => $info) {
    $static = $info['defaults']['static'];
    $class = $static['class'];
    $items["admin/config/system/cron/{$plugin_type}"] = array(
      'type' => MENU_LOCAL_TASK,
      'title' => $static['title plural proper'],
      'description' => "Administer " . $static['title plural'],
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'ultimate_cron_plugin_form',
        $plugin_type,
      ),
      'access arguments' => array(
        'administer ultimate cron',
      ),
      'file' => 'ultimate_cron.admin.inc',
      'weight' => 2 + $weight,
    );
    $items["admin/config/system/cron/{$plugin_type}/settings"] = array(
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'title' => $class::$multiple ? 'List' : 'Settings',
      'weight' => -1 + $weight,
    );
    $weight++;
    foreach (_ultimate_cron_plugin_load_all($plugin_type, TRUE) as $name => $plugin) {
      if (!$plugin
        ->isValid()) {
        continue;
      }
      $items["admin/config/system/cron/{$plugin_type}/{$name}"] = array(
        'type' => MENU_LOCAL_TASK,
        'title' => $plugin->title,
        'description' => $plugin->description,
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'ultimate_cron_plugin_settings',
          $plugin_type,
          $name,
        ),
        'access arguments' => array(
          'administer ultimate cron',
        ),
        'file' => 'ultimate_cron.admin.inc',
        'weight' => $weight++,
      );
    }
  }
  return $items;
}