diff -u b/core/modules/help/config/install/help.help.help_module.yml b/core/modules/help/config/install/help.help.help_module.yml --- b/core/modules/help/config/install/help.help.help_module.yml +++ b/core/modules/help/config/install/help.help.help_module.yml @@ -2,7 +2,7 @@ status: true dependencies: { } id: help_module -label: 'Help Module' +label: 'Help module' body: value: "

About

\r\n\r\n

The Help module provides Help reference pages to guide you through the use and configuration of modules. It is 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.

\r\n\r\n

Uses

\r\n\r\n
\r\n\t
Providing a help reference
\r\n\t
The Help module displays both static module-provided help and configured help topics on the main Help page.
\r\n\t
Configuring help topics
\r\n\t
You can add, edit, delete, and translate configured help topics on the Help topics administration page. The help topics that are listed in the Module help section of the main Help page cannot be edited or deleted.
\r\n
\r\n" format: full_html diff -u b/core/modules/help/help.routing.yml b/core/modules/help/help.routing.yml --- b/core/modules/help/help.routing.yml +++ b/core/modules/help/help.routing.yml @@ -15,7 +15,7 @@ _permission: 'access administration pages' help.topic_view: - path: 'admin/help_topic/{id}' + path: 'admin/help-topic/{id}' defaults: _content: '\Drupal\help\Controller\HelpController::helpEntityView' _title: 'Help' diff -u b/core/modules/help/src/Entity/Help.php b/core/modules/help/src/Entity/Help.php --- b/core/modules/help/src/Entity/Help.php +++ b/core/modules/help/src/Entity/Help.php @@ -18,13 +18,16 @@ * Help module installed), and then exporting them into their config/install * directories. Topics marked as "top_level" will be listed on admin/help, * and when viewing a help topic, "related" topics will be listed. Conventions: - * - Module overview help topics should have titles like "Foo Bar Module"; - * similar for overviews for themes, install profiles, etc. + * - Module overview help topics should have titles like "Foo Bar module"; + * similar for overview topics for themes, install profiles, etc. * - Module overview topics should follow * @link https://drupal.org/node/632280 the standard help template. @endlink - * - Other provided help topics should usually not be top-level topics; instead, + * - Non-overview help topics should usually not be top-level topics; instead, * make an overview topic and list other topics in the "related" section. * - All topic machine names should be prefixed by the extension machine name. + * The main topic for an extension should have machine name "name_type", + * where name is the machine name of the extension, and type is the type of + * extension (module, theme, etc.). * - Keep in mind that help topics are usually meant for administrative Drupal * users, such as site builders and content editors, rather than programmers. * only in patch2: unchanged: --- /dev/null +++ b/core/modules/help/help.services.yml @@ -0,0 +1,6 @@ +services: + help.breadcrumb: + class: Drupal\help\HelpBreadcrumbBuilder + arguments: ['@string_translation'] + tags: + - { name: breadcrumb_builder, priority: 900 } only in patch2: unchanged: --- /dev/null +++ b/core/modules/help/src/HelpBreadcrumbBuilder.php @@ -0,0 +1,51 @@ +stringTranslation = $string_translation; + } + + /** + * {@inheritdoc} + */ + public function applies(RouteMatchInterface $route_match) { + return $route_match->getRouteName() == 'help.topic_view'; + } + + /** + * {@inheritdoc} + */ + public function build(RouteMatchInterface $route_match) { + $links = array( + Link::createFromRoute($this->t('Home'), ''), + Link::createFromRoute($this->t('Administration'), 'system.admin'), + Link::createFromRoute($this->t('Help'), 'help.main'), + ); + + return $links; + } +} only in patch2: unchanged: --- a/core/modules/help/src/Tests/HelpTest.php +++ b/core/modules/help/src/Tests/HelpTest.php @@ -16,15 +16,16 @@ */ class HelpTest extends WebTestBase { + // Install with the standard profile, because it has the help block + // enabled and admin theme, etc. + protected $profile = 'standard'; + /** * Modules to enable. * * @var array. */ - public static $modules = array('shortcut'); - - // Tests help implementations of many arbitrary core modules. - protected $profile = 'standard'; + public static $modules = array('help_test'); /** * The admin user that will be created. @@ -39,8 +40,6 @@ class HelpTest extends WebTestBase { protected function setUp() { parent::setUp(); - $this->getModuleList(); - // Create users. $this->adminUser = $this->drupalCreateUser(array('access administration pages', 'view the administration theme', 'administer permissions')); $this->anyUser = $this->drupalCreateUser(array()); @@ -67,12 +66,18 @@ public function testHelp() { $this->assertRaw(t('For more information, refer to the subjects listed in the Help Topics section or to the online documentation and support pages at drupal.org.', array('!docs' => 'https://drupal.org/documentation', '!support' => 'https://drupal.org/support', '!drupal' => 'https://drupal.org')), 'Help intro text correctly appears.'); // Verify that help topics text appears. - $this->assertRaw('

' . t('Help topics') . '

' . t('Help is available on the following items:') . '

', 'Help topics text correctly appears.'); + $this->assertRaw('

' . t('Module help') . '

' . t('Help pages are available for the following modules:') . '

', 'Help module topics text correctly appears.'); + $this->assertRaw('

' . t('Configured topics') . '

' . t('Additional help topics configured on your site:') . '

', 'Help configured topics text correctly appears.'); // Make sure links are properly added for modules implementing hook_help(). foreach ($this->getModuleList() as $module => $name) { $this->assertLink($name, 0, format_string('Link properly added to @name (admin/help/@module)', array('@module' => $module, '@name' => $name))); } + + // Make sure links are properly added for topics. + foreach ($this->getTopicList() as $topic => $name) { + $this->assertLink($name, 0, format_string('Link properly added to @name (admin/help-topic/@topic)', array('@topic' => $topic, '@name' => $name))); + } } /** @@ -100,20 +105,40 @@ protected function verifyHelp($response = 200) { $this->assertRaw('

' . t($name) . '

', format_string('%module heading was displayed', array('%module' => $module))); } } + + foreach ($this->getTopicList() as $topic => $name) { + // View module help node. + $this->drupalGet('admin/help-topic/' . $topic); + $this->assertResponse($response); + if ($response == 200) { + $this->assertTitle($name . ' | Drupal', format_string('%topic title was displayed', array('%topic' => $topic))); + $this->assertRaw('

' . t($name) . '

', format_string('%topic heading was displayed', array('%topic' => $topic))); + } + } } /** - * Gets the list of enabled modules that implement hook_help(). + * Gets a list of modules to test for hook_help() pages. * * @return array - * A list of enabled modules. + * A list of modules to test, machine name => displayed name. */ protected function getModuleList() { - $modules = array(); - $module_data = system_rebuild_module_data(); - foreach (\Drupal::moduleHandler()->getImplementations('help') as $module) { - $modules[$module] = $module_data[$module]->info['name']; - } - return $modules; + return array( + 'help_test' => 'Help Test', + ); + } + + /** + * Gets a list of topic IDs to test. + * + * @return array + * A list of topics to test, machine name => displayed name. + */ + protected function getTopicList() { + return array( + 'help_module' => t('Help module'), + ); } + } only in patch2: unchanged: --- a/core/modules/help/src/Tests/NoHelpTest.php +++ b/core/modules/help/src/Tests/NoHelpTest.php @@ -43,7 +43,7 @@ public function testMainPageNoHelp() { $this->drupalGet('admin/help'); $this->assertResponse(200); - $this->assertText('Help is available on the following items', 'Help page is found.'); + $this->assertText('Help pages are available for the following modules', 'Help page is found.'); $this->assertNoText('Hook menu tests', 'Making sure the test module menu_test does not display a help link on admin/help.'); } } only in patch2: unchanged: --- /dev/null +++ b/core/modules/help/test/modules/help_test/help_test.info.yml @@ -0,0 +1,6 @@ +name: 'Help Test' +type: module +description: 'Support module for help testing.' +package: Testing +version: VERSION +core: 8.x only in patch2: unchanged: --- /dev/null +++ b/core/modules/help/test/modules/help_test/help_test.module @@ -0,0 +1,18 @@ +