function jdrupal_help in jDrupal 8
Same name and namespace in other branches
- 7 jdrupal.module \jdrupal_help()
- 8.0.x jdrupal.module \jdrupal_help()
Implements hook_help().
File
- ./
jdrupal.module, line 9
Code
function jdrupal_help($route_name, \Drupal\Core\Routing\RouteMatchInterface $route_match) {
if ($route_name == 'help.page.jdrupal') {
// Module README link.
$moduleReadmePath = drupal_get_path('module', 'jdrupal') . '/README.md';
$moduleReadmeLink = Link::fromTextAndUrl(t('Module README'), Url::fromUri('base:' . $moduleReadmePath))
->toString();
// JS Library README link.
$jsReadmeLink = Link::fromTextAndUrl(t('JavaScript Library README'), Url::fromUri('https://github.com/easystreet3/jDrupal/blob/8.x-1.x/README.md'))
->toString();
// Drupal 8 REST config link.
$restConfigLink = Link::fromTextAndUrl(t('Configure Drupal 8 REST'), Url::fromRoute('restui.list'))
->toString();
// Project docs.
$projectDocs = Link::fromTextAndUrl(t('jDrupal Documentation'), Url::fromUri('http://jdrupal.easystreet3.com/8/docs/'))
->toString();
// Project api.
$projectAPI = Link::fromTextAndUrl(t('jDrupal API'), Url::fromUri('http://jdrupal.easystreet3.com/8/api/'))
->toString();
// Hello world.
$helloWorld = Link::fromTextAndUrl(t('Hello World'), Url::fromUri('http://jdrupal.easystreet3.com/8/docs/Hello_World'))
->toString();
// Return the help text.
// @TODO convert to render element once Drupal 8 supports it in hook_help().
$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;
}
}