public HelpController::helpMain()
Prints a page listing various types of help.
The page has sections defined by \Drupal\help\HelpSectionPluginInterface plugins.
Return value
array A render array for the help page.
File
- core/modules/help/src/Controller/HelpController.php, line 63
Class
- HelpController
- Controller routines for help routes.
Namespace
Drupal\help\Controller
Code
public function helpMain() { $output = []; // We are checking permissions, so add the user.permissions cache context. $cacheability = new CacheableMetadata(); $cacheability->addCacheContexts(['user.permissions']); $plugins = $this->helpManager->getDefinitions(); $cacheability->addCacheableDependency($this->helpManager); foreach ($plugins as $plugin_id => $plugin_definition) { // Check the provided permission. if (!empty($plugin_definition['permission']) && !$this->currentuser()->hasPermission($plugin_definition['permission'])) { continue; } // Add the section to the page. /** @var \Drupal\help\HelpSectionPluginInterface $plugin */ $plugin = $this->helpManager->createInstance($plugin_id); $this_output = [ '#theme' => 'help_section', '#title' => $plugin->getTitle(), '#description' => $plugin->getDescription(), '#empty' => $this->t('There is currently nothing in this section.'), '#links' => [], ]; $links = $plugin->listTopics(); if (is_array($links) && count($links)) { $this_output['#links'] = $links; } $cacheability->addCacheableDependency($plugin); $output[$plugin_id] = $this_output; } $cacheability->applyTo($output); return $output; }
Please login to continue.