diff --git a/core/modules/tour/tour.module b/core/modules/tour/tour.module index 4e410c0..2e9b412 100644 --- a/core/modules/tour/tour.module +++ b/core/modules/tour/tour.module @@ -7,6 +7,54 @@ use Drupal\Core\Cache\CacheBackendInterface; /** + * Implements hook_help(). + */ +function tour_help($path, $arg) { + switch ($path) { + case 'admin/help#tour': + $output = ''; + $output .= '

' . t('About') . '

'; + $output .= '

' . t("The Tour module provides users with a context-sensitive overview of user interfaces throughout the site. For more information, see the online documentation for the Tour module.", array('!tour' => 'https://drupal.org/documentation/modules/tour')) . '

'; + $output .= '

' . t('Uses') . '

'; + $output .= '
'; + $output .= '
' . t('Viewing tours') . '
'; + $output .= '
' . t("When a tour is available on a page, a Tour button will be visible in the toolbar. Clicking the Tour button will guide the user through the key elements of that page's user interface. A tour may also recommend related tours on the site to the user, which can be taken in sequence to provide a walkthrough of the site in a structured manner.") . '
'; + $output .= '
' . t('Creating tours') . '
'; + $output .= '
' . t("Tours can be used to highlight critical components of the user interface to the user, guide the user through a workflow, or explain key Drupal concepts. Tours can be written as YAML-documents with a text editor, or using Tour UI. For more information, see the online documentation for writing tours.", array('!doc_url' => 'https://drupal.org/developing/api/tour', '!tour_ui' => 'https://drupal.org/project/tour_ui')) . '
'; + $output .= '
'; + + $names = drupal_container()->get('config.storage')->listAll('tour.tour.'); + $tours = array(); + foreach ($names as $name) { + // Only handle elements with a schema. The schema system falls back on the + // Property class for unknown types. See http://drupal.org/node/1905230 + $definition = config_typed()->getDefinition($name); + if (is_array($definition) && $definition['class'] == '\Drupal\Core\Config\Schema\Property') { + continue; + } + $tour = config_typed()->get($name)->getValue(); + $label = $tour['label']; + $paths = $tour['paths']; + $tips = count($tour['tips']); + $links = array(); + foreach ($paths as $path) { + if (strpos($path, "*") === FALSE) { + $links[] = l($path, $path, array('query' => array('tour' => 1))); + } + else { + $links[] = check_plain($path); + } + } + $link = theme('item_list', array('items' => $links)); + $tours[] = $label . ' (' . $tips . '): ' . $link; + } + $output .= theme('item_list', array('items' => $tours, 'title' => 'Available tours.')); + + return $output; + } +} + +/** * Implements hook_permission(). */ function tour_permission() {