You are here

jdrupal.module in jDrupal 8

Same filename and directory in other branches
  1. 7 jdrupal.module
  2. 8.0.x jdrupal.module

File

jdrupal.module
View source
<?php

use Drupal\Core\Link;
use Drupal\Core\Url;

/**
 * Implements hook_help().
 */
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;
  }
}

Functions

Namesort descending Description
jdrupal_help Implements hook_help().