Commit 20240da2 authored by Rob Phillips's avatar Rob Phillips
Browse files

Issue #3285080 by robphillips: Implements hook_help() with documentation link.

parent 81ab3ca8
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -10,6 +10,8 @@ use Drupal\Core\Entity\Display\EntityFormDisplayInterface;
use Drupal\Core\Entity\EntityFormInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Markup;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;

/**
 * Implements hook_form_alter().
@@ -193,3 +195,21 @@ function entity_confirmation_form_op_submit(array &$form, FormStateInterface $fo
    }
  }
}

/**
 * Implements hook_help().
 */
function entity_confirmation_help($route_name, RouteMatchInterface $route_match): string {
  $build = [];
  if ($route_name === 'help.page.entity_confirmation') {
    $build[] = [
      '#markup' => '<h2>' . t('Documentation') . '</h2>',
    ];
    $build[] = [
      '#type' => 'link',
      '#title' => 'https://git.drupalcode.org/project/entity_confirmation/-/blob/1.x/README.md',
      '#url' => Url::fromUri('https://git.drupalcode.org/project/entity_confirmation/-/blob/1.x/README.md'),
    ];
  }
  return \Drupal::service('renderer')->render($build);
}