You are here

function weather_help in Weather 8

Same name and namespace in other branches
  1. 5.6 weather.module \weather_help()
  2. 6.5 weather.module \weather_help()
  3. 7.3 weather.module \weather_help()
  4. 7 weather.module \weather_help()
  5. 7.2 weather.module \weather_help()
  6. 2.0.x weather.module \weather_help()

Implements hook_help().

File

./weather.module, line 15
Main module file with hooks implementations.

Code

function weather_help($route_name, RouteMatchInterface $route_match) {
  $output = '';
  switch ($route_name) {
    case 'help.page.weather':
      $path = __DIR__ . '/README.txt';
      if (file_exists($path)) {
        $output = '<pre>' . file_get_contents($path) . '</pre>';
      }
      break;
    case 'weather.settings':
      $output .= '<p>';
      $output .= t('You can add, edit, and delete locations from system-wide weather displays. Moreover, you can specify default values for newly created displays. If you want to change the format of the displayed date, you can do that in the <a href="@url">date configuration</a>.', [
        '@url' => Url::fromRoute('entity.date_format.collection')
          ->toString(),
      ]);
      $output .= '</p>';
      break;
    case 'weather.user.settings':
      $output .= '<p>';
      $output .= t('You can add, edit, and delete locations from your custom weather display.');
      $output .= "\n";
      $output .= t('Please note that the display will not be shown until you configure at least one location.');
      $output .= '</p>';
      break;
  }
  return $output;
}