Commit c21835eb authored by Rob Phillips's avatar Rob Phillips
Browse files

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

parent 663e09c7
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Integrates Choices.js plugin with entity reference autocomplete fields.
 */

use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;

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