You are here

function forum_help in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/forum/forum.module \forum_help()
  2. 4 modules/forum.module \forum_help()
  3. 5 modules/forum/forum.module \forum_help()
  4. 6 modules/forum/forum.module \forum_help()
  5. 7 modules/forum/forum.module \forum_help()

Implements hook_help().

File

core/modules/forum/forum.module, line 22
Provides discussion forums.

Code

function forum_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.forum':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('The Forum module lets you create threaded discussion forums with functionality similar to other message board systems. In a forum, users post topics and threads in nested hierarchies, allowing discussions to be categorized and grouped.') . '</p>';
      $output .= '<p>' . t('The Forum module adds and uses a content type called <em>Forum topic</em>. For background information on content types, see the <a href=":node_help">Node module help page</a>.', [
        ':node_help' => Url::fromRoute('help.page', [
          'name' => 'node',
        ])
          ->toString(),
      ]) . '</p>';
      $output .= '<p>' . t('A forum is represented by a hierarchical structure, consisting of:');
      $output .= '<ul>';
      $output .= '<li>' . t('<em>Forums</em> (for example, <em>Recipes for cooking vegetables</em>)') . '</li>';
      $output .= '<li>' . t('<em>Forum topics</em> submitted by users (for example, <em>How to cook potatoes</em>), which start discussions.') . '</li>';
      $output .= '<li>' . t('Threaded <em>comments</em> submitted by users (for example, <em>You wash the potatoes first and then...</em>).') . '</li>';
      $output .= '<li>' . t('Optional <em>containers</em>, used to group similar forums. Forums can be placed inside containers, and vice versa.') . '</li>';
      $output .= '</ul>';
      $output .= '</p>';
      $output .= '<p>' . t('For more information, see the <a href=":forum">online documentation for the Forum module</a>.', [
        ':forum' => 'https://www.drupal.org/documentation/modules/forum',
      ]) . '</p>';
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Setting up the forum structure') . '</dt>';
      $output .= '<dd>' . t('Visit the <a href=":forums">Forums page</a> to set up containers and forums to hold your discussion topics.', [
        ':forums' => Url::fromRoute('forum.overview')
          ->toString(),
      ]) . '</dd>';
      $output .= '<dt>' . t('Starting a discussion') . '</dt>';
      $output .= '<dd>' . t('The <a href=":create-topic">Forum topic</a> link on the <a href=":content-add">Add content</a> page creates the first post of a new threaded discussion, or thread.', [
        ':create-topic' => Url::fromRoute('node.add', [
          'node_type' => 'forum',
        ])
          ->toString(),
        ':content-add' => Url::fromRoute('node.add_page')
          ->toString(),
      ]) . '</dd>';
      $output .= '<dt>' . t('Navigating in the forum') . '</dt>';
      $output .= '<dd>' . t('Enabling the Forum module provides a default <em>Forums</em> menu link in the Tools menu that links to the <a href=":forums">Forums page</a>.', [
        ':forums' => Url::fromRoute('forum.index')
          ->toString(),
      ]) . '</dd>';
      $output .= '<dt>' . t('Moving forum topics') . '</dt>';
      $output .= '<dd>' . t('A forum topic (and all of its comments) may be moved between forums by selecting a different forum while editing a forum topic. When moving a forum topic between forums, the <em>Leave shadow copy</em> option creates a link in the original forum pointing to the new location.') . '</dd>';
      $output .= '<dt>' . t('Locking and disabling comments') . '</dt>';
      $output .= '<dd>' . t('Selecting <em>Closed</em> under <em>Comment settings</em> while editing a forum topic will lock (prevent new comments on) the thread. Selecting <em>Hidden</em> under <em>Comment settings</em> while editing a forum topic will hide all existing comments on the thread, and prevent new ones.') . '</dd>';
      $output .= '</dl>';
      return $output;
    case 'forum.overview':
      $output = '<p>' . t('Forums contain forum topics. Use containers to group related forums.') . '</p>';
      $more_help_link = [
        '#type' => 'link',
        '#url' => Url::fromRoute('help.page', [
          'name' => 'forum',
        ]),
        '#title' => t('More help'),
        '#attributes' => [
          'class' => [
            'icon-help',
          ],
        ],
      ];
      $container = [
        '#theme' => 'container',
        '#children' => $more_help_link,
        '#attributes' => [
          'class' => [
            'more-link',
          ],
        ],
      ];
      $output .= \Drupal::service('renderer')
        ->renderPlain($container);
      return $output;
    case 'forum.add_container':
      return '<p>' . t('Use containers to group related forums.') . '</p>';
    case 'forum.add_forum':
      return '<p>' . t('A forum holds related forum topics.') . '</p>';
    case 'forum.settings':
      return '<p>' . t('Adjust the display of your forum topics. Organize the forums on the <a href=":forum-structure">forum structure page</a>.', [
        ':forum-structure' => Url::fromRoute('forum.overview')
          ->toString(),
      ]) . '</p>';
  }
}