View source
<?php
use Drupal\Core\Link;
use Drupal\Core\Url;
function jdrupal_help($route_name, \Drupal\Core\Routing\RouteMatchInterface $route_match) {
if ($route_name == 'help.page.jdrupal') {
$moduleReadmePath = drupal_get_path('module', 'jdrupal') . '/README.md';
$moduleReadmeLink = Link::fromTextAndUrl(t('Module README'), Url::fromUri('base:' . $moduleReadmePath))
->toString();
$jsReadmeLink = Link::fromTextAndUrl(t('JavaScript Library README'), Url::fromUri('https://github.com/easystreet3/jDrupal/blob/8.x-1.x/README.md'))
->toString();
$restConfigLink = Link::fromTextAndUrl(t('Configure Drupal 8 REST'), Url::fromRoute('restui.list'))
->toString();
$projectDocs = Link::fromTextAndUrl(t('jDrupal Documentation'), Url::fromUri('http://jdrupal.easystreet3.com/8/docs/'))
->toString();
$projectAPI = Link::fromTextAndUrl(t('jDrupal API'), Url::fromUri('http://jdrupal.easystreet3.com/8/api/'))
->toString();
$helloWorld = Link::fromTextAndUrl(t('Hello World'), Url::fromUri('http://jdrupal.easystreet3.com/8/docs/Hello_World'))
->toString();
$msg = t('Use jDrupal to easily communicate with Drupal 8 REST and JavaScript.');
$help = "<p>{$msg}</p>";
$help .= "<ul>";
$help .= "<li>{$moduleReadmeLink}</li>";
$help .= "<li>{$jsReadmeLink}</li>";
$help .= "<li>{$restConfigLink}</li>";
$help .= "<li>{$projectDocs}</li>";
$help .= "<li>{$projectAPI}</li>";
$help .= "<li>{$helloWorld}</li>";
$help .= "</ul>";
return $help;
}
}