From 7a77474517bb48c6730b4c286947dce4218ce244 Mon Sep 17 00:00:00 2001
From: Jeffrey Fortune <jfortune@tombras.com>
Date: Sun, 10 Feb 2019 00:15:23 -0500
Subject: [PATCH] add in the help hook for the drupal help page.

---
 bg_img_field.module | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/bg_img_field.module b/bg_img_field.module
index be6eb50..e973547 100644
--- a/bg_img_field.module
+++ b/bg_img_field.module
@@ -5,7 +5,34 @@
  * Provides a way to add background images dynamically.
  */
 
+use Drupal\Core\Url;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Routing\RouteMatchInterface;
+
+/**
+ * Implements hook_help().
+ */
+function bg_img_field_help($route_name, RouteMatchInterface $route_match) {
+  switch ($route_name) {
+    case 'help.page.bg_img_field':
+      $links = [
+        ':field' => Url::fromRoute('help.page', ['name' => 'field'])->toString(),
+        ':field_ui' => (\Drupal::moduleHandler()->moduleExists('field_ui')) ?
+        Url::fromRoute('help.page', ['name' => 'field_ui'])->toString() : '#',
+      ];
+      $output = '<h3>' . t('About') . '</h3>';
+      $output .= '<p>';
+      $output .= t('Background Image Field module allows you to create a field on an entity type. It requires responsive images mapping in order to offer the best image quality for the device it is rendering on. The field will define the CSS selector to attach the background image too and then allow you basic CSS options repeat, size, and position so you can define a  style per image in your content.');
+      $output .= '</p>';
+      $output .= '<p>';
+      $output .= t('Administrators can add background image field on the <a href=":field_ui">Field UI</a> if module is enabled. For more information on fields see the <a href=":field">Field module help page</a>.', $links);
+      $output .= '</p>';
+      $output .= '<p>';
+      $output .= t("Project documentation can be found on the project page, <a href='https://www.drupal.org/project/bg_img_field' target='_blank'>Background Image Field</a>.");
+      $output .= '</p>';
+      return $output;
+  }
+}
 
 /**
  * Implements hook_form_alter().
-- 
GitLab