You are here

function farm_quick_help in farmOS 2.x

Implements hook_help().

File

modules/core/quick/farm_quick.module, line 14
The farmOS Quick Form module.

Code

function farm_quick_help($route_name, RouteMatchInterface $route_match) {
  $output = '';

  // Quick forms index help text.
  if ($route_name == 'farm.quick') {
    $output .= '<p>' . t('Quick forms make it easy to record common activities.') . '</p>';
  }

  // Load help text for individual quick forms.
  if ($route_name == 'farm.quick.form') {
    $quick_form_id = $route_match
      ->getParameter('id');
    $quick_form = \Drupal::service('plugin.manager.quick_form')
      ->createInstance($quick_form_id);
    $help_text = $quick_form
      ->getHelpText();
    if (!empty($help_text)) {
      $output .= '<p>' . $help_text . '</p>';
    }
  }
  return $output;
}