Skip to content
Snippets Groups Projects
Verified Commit 97ca0616 authored by Dave Long's avatar Dave Long
Browse files

Issue #2942016 by Rassoni, markconroy, David_Rothstein, kaythay, smustgrave,...

Issue #2942016 by Rassoni, markconroy, David_Rothstein, kaythay, smustgrave, John Cook, catch: Add a hook_help() to the Umami profile, and link to it from the toolbar when the Help module is enabled
parent 8b6814e4
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,28 @@
use Drupal\contact\Entity\ContactForm;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
/**
* Implements hook_help().
*/
function demo_umami_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.demo_umami':
$output = '';
$output .= '<h2>' . t('About') . '</h2>';
$output .= '<p>' . t('Umami is an example food magazine website that demonstrates some of the features of Drupal core. It is intended to be used as an example site, rather than as a foundation for building your own site. For more information, see the <a href=":demo_umami">online documentation for the Umami installation profile</a>.', [':demo_umami' => 'https://www.drupal.org/node/2941833']) . '</p>';
$output .= '<h2>' . t('Uses') . '</h2>';
$output .= '<h3>' . t('Demonstrating Drupal core functionality') . '</h3>';
$output .= '<p>' . t('You can look around the site to get ideas for what kinds of features Drupal is capable of, and to see how an actual site can be built using Drupal core.') . '</p>';
$output .= '<h3>' . t('Sample content') . '</h3>';
$output .= '<p>' . t('The Umami profile is very handy if you are developing a feature and need some sample content.') . '</p>';
$output .= '<h2>' . t('What to do when you are ready to build your Drupal website') . '</h2>';
$output .= '<p>' . t("Once you've tried Drupal using Umami and want to build your own site, simply reinstall Drupal and select a different installation profile (such as Standard) from the install screen.") . '</p>';
return $output;
}
}
/**
* Implements hook_form_FORM_ID_alter() for install_configure_form().
......@@ -64,12 +86,16 @@ function demo_umami_toolbar() {
// Show warning only on administration pages.
$admin_context = \Drupal::service('router.admin_context');
if ($admin_context->isAdminRoute()) {
$link_to_help_page = \Drupal::moduleHandler()->moduleExists('help') && \Drupal::currentUser()->hasPermission('access administration pages');
$items['experimental-profile-warning']['#type'] = 'toolbar_item';
$items['experimental-profile-warning']['tab'] = [
'#type' => 'inline_template',
'#template' => '<a class="toolbar-warning" href="{{ more_info_link }}">This site is intended for demonstration purposes.</a>',
'#context' => [
'more_info_link' => 'https://www.drupal.org/node/2941833',
// Link directly to the drupal.org documentation if the help pages
// aren't available.
'more_info_link' => $link_to_help_page ? Url::fromRoute('help.page', ['name' => 'demo_umami'])
: 'https://www.drupal.org/node/2941833',
],
'#attached' => [
'library' => ['demo_umami/toolbar-warning'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment