You are here

function layout_builder_help in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/layout_builder.module \layout_builder_help()
  2. 10 core/modules/layout_builder/layout_builder.module \layout_builder_help()

Implements hook_help().

File

core/modules/layout_builder/layout_builder.module, line 34
Provides hook implementations for Layout Builder.

Code

function layout_builder_help($route_name, RouteMatchInterface $route_match) {

  // Add help text to the Layout Builder UI.
  if ($route_match
    ->getRouteObject()
    ->getOption('_layout_builder')) {
    $output = '<p>' . t('This layout builder tool allows you to configure the layout of the main content area.') . '</p>';
    if (\Drupal::currentUser()
      ->hasPermission('administer blocks')) {
      $output .= '<p>' . t('To manage other areas of the page, use the <a href="@block-ui">block administration page</a>.', [
        '@block-ui' => Url::fromRoute('block.admin_display')
          ->toString(),
      ]) . '</p>';
    }
    else {
      $output .= '<p>' . t('To manage other areas of the page, use the block administration page.') . '</p>';
    }
    $output .= '<p>' . t('Forms and links inside the content of the layout builder tool have been disabled.') . '</p>';
    return $output;
  }
  switch ($route_name) {
    case 'help.page.layout_builder':
      $output = '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('Layout Builder allows you to use layouts to customize how content, custom blocks, and other <a href=":field_help" title="Field module help, with background on content entities">content entities</a> are displayed.', [
        ':field_help' => Url::fromRoute('help.page', [
          'name' => 'field',
        ])
          ->toString(),
      ]) . '</p>';
      $output .= '<p>' . t('For more information, see the <a href=":layout-builder-documentation">online documentation for the Layout Builder module</a>.', [
        ':layout-builder-documentation' => 'https://www.drupal.org/docs/8/core/modules/layout-builder',
      ]) . '</p>';
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Default layouts') . '</dt>';
      $output .= '<dd>' . t('Layout Builder can be selectively enabled on the "Manage Display" page in the <a href=":field_ui">Field UI</a>. This allows you to control the output of each type of display individually. For example, a "Basic page" might have view modes such as Full and Teaser, with each view mode having different layouts selected.', [
        ':field_ui' => Url::fromRoute('help.page', [
          'name' => 'field_ui',
        ])
          ->toString(),
      ]) . '</dd>';
      $output .= '<dt>' . t('Overridden layouts') . '</dt>';
      $output .= '<dd>' . t('If enabled, each individual content item can have a custom layout. Once the layout for an individual content item is overridden, changes to the Default layout will no longer affect it. Overridden layouts may be reverted to return to matching and being synchronized to their Default layout.') . '</dd>';
      $output .= '<dt>' . t('User permissions') . '</dt>';
      $output .= '<dd>' . t('The Layout Builder module makes a number of permissions available, which can be set by role on the <a href=":permissions">permissions page</a>. For more information, see the <a href=":layout-builder-permissions">Configuring Layout Builder permissions</a> online documentation.', [
        ':permissions' => Url::fromRoute('user.admin_permissions', [], [
          'fragment' => 'module-layout_builder',
        ])
          ->toString(),
        ':layout-builder-permissions' => 'https://www.drupal.org/docs/8/core/modules/layout-builder/configuring-layout-builder-permissions',
      ]) . '</dd>';
      $output .= '</dl>';
      return $output;
  }
}