You are here

function scheduler_help in Scheduler 2.x

Same name and namespace in other branches
  1. 8 scheduler.module \scheduler_help()
  2. 5 scheduler.module \scheduler_help()
  3. 6 scheduler.module \scheduler_help()
  4. 7 scheduler.module \scheduler_help()

Implements hook_help().

File

./scheduler.module, line 20
Scheduler publishes and unpublishes entities on dates specified by the user.

Code

function scheduler_help($route_name, RouteMatchInterface $route_match) {
  $output = '';
  switch ($route_name) {
    case 'help.page.scheduler':
      $output = '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('The Scheduler module provides the functionality for automatic publishing and unpublishing of entities, such and nodes and media items, at specified future dates.') . '</p>';
      $output .= '<p>' . t('You can read more in the <a href="@readme">readme</a> file or our <a href="@project">project page on Drupal.org</a>.', [
        '@readme' => $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'scheduler') . '/README.md',
        '@project' => 'https://drupal.org/project/scheduler',
      ]) . '</p>';
      break;
    case 'scheduler.cron_form':
      $base_url = $GLOBALS['base_url'];
      $access_key = \Drupal::config('scheduler.settings')
        ->get('lightweight_cron_access_key');
      $cron_url = $base_url . '/scheduler/cron/' . $access_key;
      $output = '<p>' . t("When you have set up Drupal's standard crontab job cron.php then Scheduler will be executed during each cron run. However, if you would like finer granularity to scheduler, but don't want to run Drupal's cron more often then you can use the lightweight cron handler provided by Scheduler. This is an independent cron job which only runs the scheduler process and does not execute any cron tasks defined by Drupal core or any other modules.") . '</p>';
      $output .= '<p>' . t("Scheduler's cron is at /scheduler/cron/{access-key} and a sample crontab entry to run scheduler every minute might look like:") . '</p>';
      $output .= '<code>* * * * * wget -q -O /dev/null "' . $cron_url . '"</code>';
      $output .= '<p>' . t('or') . '</p>';
      $output .= '<code>* * * * * curl -s -o /dev/null "' . $cron_url . '"</code><br/><br/>';
      break;
    default:
  }
  return $output;
}