' . $this->t('Getting Started') . ''; $output .= '

' . $this->t('Follow these steps to set up and start using your website:') . '

'; $output .= '
    '; $output .= '
  1. ' . $this->t('Configure your website Once logged in, visit the Administration page, where you may customize and configure all aspects of your website.', [ ':admin' => Url::fromRoute('system.admin')->toString(), ':config' => Url::fromRoute('system.admin_config')->toString(), ]) . '
  2. '; $output .= '
  3. ' . $this->t('Enable additional functionality Next, visit the Extend page and install modules that suit your specific needs. You can find additional modules at the Drupal.org modules page.', [ ':modules' => Url::fromRoute('system.modules_list')->toString(), ':download_modules' => 'https://www.drupal.org/project/modules', ]) . '
  4. '; $output .= '
  5. ' . $this->t('Customize your website design To change the "look and feel" of your website, visit the Appearance page. You may choose from one of the included themes or download additional themes from the Drupal.org themes page.', [ ':themes' => Url::fromRoute('system.themes_page')->toString(), ':download_themes' => 'https://www.drupal.org/project/themes', ]) . '
  6. '; // Display a link to the create content page if Node module is // installed. if (\Drupal::moduleHandler()->moduleExists('node')) { $output .= '
  7. ' . $this->t('Start posting content Finally, you may add new content to your website.', [':content' => Url::fromRoute('node.add_page')->toString()]) . '
  8. '; } $output .= '
'; $output .= '

' . $this->t('For more information, refer to the help listed on this page or to the online documentation and support pages at drupal.org.', [ ':docs' => 'https://www.drupal.org/documentation', ':support' => 'https://www.drupal.org/support', ':drupal' => 'https://www.drupal.org', ]) . '

'; return ['#markup' => $output]; case 'help.page.help': $help_home = Url::fromRoute('help.main')->toString(); $module_handler = \Drupal::moduleHandler(); $locale_help = $module_handler->moduleExists('locale') ? Url::fromRoute('help.page', ['name' => 'locale'])->toString() : '#'; $search_help = $module_handler->moduleExists('search') ? Url::fromRoute('help.page', ['name' => 'search'])->toString() : '#'; $output = '

' . $this->t('About') . '

'; $output .= '

' . $this->t('The Help module generates Help topics and reference pages to guide you through the use and configuration of modules, and provides a Help block with page-level help. The reference pages are a starting point for Drupal.org online documentation pages that contain more extensive and up-to-date information, are annotated with user-contributed comments, and serve as the definitive reference point for all Drupal documentation. For more information, see the online documentation for the Help module.', [ ':help' => 'https://www.drupal.org/documentation/modules/help/', ':handbook' => 'https://www.drupal.org/documentation', ':help-page' => Url::fromRoute('help.main')->toString(), ]) . '

'; $output .= '

' . $this->t('Help topics provided by modules and themes are also part of the Help module. If the core Search module is installed, these topics are searchable. For more information, see the online documentation, Help Topic Standards.', [ ':online' => 'https://www.drupal.org/docs/develop/managing-a-drupalorg-theme-module-or-distribution-project/documenting-your-project/help-topic-standards', ]) . '

'; $output .= '

' . $this->t('Uses') . '

'; $output .= '
'; $output .= '
' . $this->t('Providing a help reference') . '
'; $output .= '
' . $this->t('The Help module displays explanations for using each module listed on the main Help reference page.', [':help' => Url::fromRoute('help.main')->toString()]) . '
'; $output .= '
' . $this->t('Providing page-specific help') . '
'; $output .= '
' . $this->t('Page-specific help text provided by modules is displayed in the Help block. This block can be placed and configured on the Block layout page.', [ ':blocks' => \Drupal::moduleHandler()->moduleExists('block') ? Url::fromRoute('block.admin_display')->toString() : '#', ]) . '
'; $output .= '
' . $this->t('Viewing help topics') . '
'; $output .= '
' . $this->t('The top-level help topics are listed on the main Help page. Links to other topics, including non-top-level help topics, can be found under the "Related" heading when viewing a topic page.', [':help_page' => $help_home]) . '
'; $output .= '
' . $this->t('Providing help topics') . '
'; $output .= '
' . $this->t("Modules and themes can provide help topics as Twig-file-based plugins in a project sub-directory called help_topics; plugin meta-data is provided in YAML front matter within each Twig file. Plugin-based help topics provided by modules and themes will automatically be updated when a module or theme is updated. Use the plugins in core/modules/help/help_topics as a guide when writing and formatting a help topic plugin for your theme or module.") . '
'; $output .= '
' . $this->t('Translating help topics') . '
'; $output .= '
' . $this->t('The title and body text of help topics provided by contributed modules and themes are translatable using the Interface Translation module. Topics provided by custom modules and themes are also translatable if they have been viewed at least once in a non-English language, which triggers putting their translatable text into the translation database.', [':locale_help' => $locale_help]) . '
'; $output .= '
' . $this->t('Configuring help search') . '
'; $output .= '
' . $this->t('To search help, you will need to install the core Search module, configure a search page, and add a search block to the Help page or another administrative page. (A search page is provided automatically, and if you use the core Claro administrative theme, a help search block is shown on the main Help page.) Then users with search permissions, and permission to view help, will be able to search help. See the Search module help page for more information.', [':search_help' => $search_help]) . '
'; $output .= '
'; return ['#markup' => $output]; case 'help.help_topic': $help_home = Url::fromRoute('help.main')->toString(); return '

' . $this->t('See the Help page for more topics.', [':help_page' => $help_home]) . '

'; } return NULL; } /** * Implements hook_theme(). */ #[Hook('theme')] public function theme($existing, $type, $theme, $path) : array { return [ 'help_section' => [ 'variables' => [ 'title' => NULL, 'description' => NULL, 'links' => NULL, 'empty' => NULL, ], ], 'help_topic' => [ 'variables' => [ 'body' => [], 'related' => [], ], ], ]; } /** * Implements hook_block_view_BASE_BLOCK_ID_alter(). */ #[Hook('block_view_help_block_alter')] public function blockViewHelpBlockAlter(array &$build, BlockPluginInterface $block): void { // Assume that most users do not need or want to perform contextual actions // on the help block, so don't needlessly draw attention to it. unset($build['#contextual_links']); } /** * Implements hook_modules_uninstalled(). */ #[Hook('modules_uninstalled')] public function modulesUninstalled(array $modules): void { _help_search_update($modules); } /** * Implements hook_themes_uninstalled(). */ #[Hook('themes_uninstalled')] public function themesUninstalled(array $themes): void { \Drupal::service('plugin.cache_clearer')->clearCachedDefinitions(); _help_search_update(); } /** * Implements hook_modules_installed(). */ #[Hook('modules_installed')] public function modulesInstalled(array $modules, $is_syncing): void { _help_search_update(); } /** * Implements hook_themes_installed(). */ #[Hook('themes_installed')] public function themesInstalled(array $themes): void { \Drupal::service('plugin.cache_clearer')->clearCachedDefinitions(); _help_search_update(); } }