Same name and namespace in other branches
  1. 4.6.x modules/contact.module \contact_help()
  2. 4.7.x modules/contact.module \contact_help()
  3. 5.x modules/contact/contact.module \contact_help()
  4. 6.x modules/contact/contact.module \contact_help()
  5. 7.x modules/contact/contact.module \contact_help()
  6. 8.9.x core/modules/contact/contact.module \contact_help()
  7. 9 core/modules/contact/contact.module \contact_help()

Implements hook_help().

File

core/modules/contact/contact.module, line 17
Enables the use of personal and site-wide contact forms.

Code

function contact_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.contact':
      $menu_page = \Drupal::moduleHandler()
        ->moduleExists('menu_ui') ? Url::fromRoute('entity.menu.collection')
        ->toString() : '#';
      $block_page = \Drupal::moduleHandler()
        ->moduleExists('block') ? Url::fromRoute('block.admin_display')
        ->toString() : '#';
      $contact_page = Url::fromRoute('entity.contact_form.collection')
        ->toString();
      $output = '';
      $output .= '<h2>' . t('About') . '</h2>';
      $output .= '<p>' . t('The Contact module allows visitors to contact registered users on your site, using the personal contact form, and also allows you to set up site-wide contact forms. For more information, see the <a href=":contact">online documentation for the Contact module</a>.', [
        ':contact' => 'https://www.drupal.org/documentation/modules/contact',
      ]) . '</p>';
      $output .= '<h2>' . t('Uses') . '</h2>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Using the personal contact form') . '</dt>';
      $output .= '<dd>' . t("Site visitors can email registered users on your site by using the personal contact form, without knowing or learning the email address of the recipient. When a site visitor is viewing a user profile, the viewer will see a <em>Contact</em> tab or link, which leads to the personal contact form. The personal contact link is not shown when you are viewing your own profile, and users must have both <em>View user information</em> (to see user profiles) and <em>Use users' personal contact forms</em> permission to see the link. The user whose profile is being viewed must also have their personal contact form enabled (this is a user account setting); viewers with <em>Administer users</em> permission can bypass this setting.") . '</dd>';
      $output .= '<dt>' . t('Configuring contact forms') . '</dt>';
      $output .= '<dd>' . t('On the <a href=":contact_admin">Contact forms page</a>, you can configure the fields and display of the personal contact form, and you can set up one or more site-wide contact forms. Each site-wide contact form has a machine name, a label, and one or more defined recipients; when a site visitor submits the form, the field values are sent to those recipients.', [
        ':contact_admin' => $contact_page,
      ]) . '</dd>';
      $output .= '<dt>' . t('Linking to contact forms') . '</dt>';
      $output .= '<dd>' . t('One site-wide contact form can be designated as the default contact form. If you choose to designate a default form, the <em>Contact</em> menu link in the <em>Footer</em> menu will link to it. You can modify this link from the <a href=":menu-settings">Menus page</a> if you have the Menu UI module installed. You can also create links to other contact forms; the URL for each form you have set up has format <em>contact/machine_name_of_form</em>.', [
        ':menu-settings' => $menu_page,
      ]) . '</p>';
      $output .= '<dt>' . t('Adding content to contact forms') . '</dt>';
      $output .= '<dd>' . t('From the <a href=":contact_admin">Contact forms page</a>, you can configure the fields to be shown on contact forms, including their labels and help text. If you would like other content (such as text or images) to appear on a contact form, use a block. You can create and edit blocks on the <a href=":blocks">Block layout page</a>, if the Block module is installed.', [
        ':blocks' => $block_page,
        ':contact_admin' => $contact_page,
      ]) . '</dd>';
      $output .= '</dl>';
      return $output;
  }
}