diff --git a/core/modules/help_topics/help_topics.tokens.inc b/core/modules/help_topics/help_topics.tokens.inc index 979e369acc..ac0e4fd948 100644 --- a/core/modules/help_topics/help_topics.tokens.inc +++ b/core/modules/help_topics/help_topics.tokens.inc @@ -13,8 +13,8 @@ */ function help_topics_token_info() { $types['help_topic'] = [ - 'name' => t("Help Topics"), - 'description' => t("Tokens for help topics."), + 'name' => t('Help Topics'), + 'description' => t('Tokens for help topics.'), ]; $topics = []; diff --git a/core/modules/help_topics/src/Controller/HelpTopicPluginController.php b/core/modules/help_topics/src/Controller/HelpTopicPluginController.php index 2193dad4a1..cefcabd378 100644 --- a/core/modules/help_topics/src/Controller/HelpTopicPluginController.php +++ b/core/modules/help_topics/src/Controller/HelpTopicPluginController.php @@ -16,13 +16,6 @@ */ class HelpTopicPluginController extends ControllerBase { - /** - * The token replacement service class. - * - * @var \Drupal\Core\Utility\Token - */ - protected $token; - /** * The renderer service. * @@ -47,9 +40,8 @@ class HelpTopicPluginController extends ControllerBase { * @param \Drupal\Core\Render\RendererInterface $renderer * The renderer service. */ - public function __construct(HelpTopicPluginManagerInterface $help_topic_plugin_manager, Token $token, RendererInterface $renderer) { + public function __construct(HelpTopicPluginManagerInterface $help_topic_plugin_manager, RendererInterface $renderer) { $this->helpTopicPluginManager = $help_topic_plugin_manager; - $this->token = $token; $this->renderer = $renderer; } @@ -59,7 +51,6 @@ public function __construct(HelpTopicPluginManagerInterface $help_topic_plugin_m public static function create(ContainerInterface $container) { return new static( $container->get('plugin.manager.help_topic'), - $container->get('token'), $container->get('renderer') ); } diff --git a/core/modules/help_topics/src/Plugin/HelpTopic/HelpTopicPluginInterface.php b/core/modules/help_topics/src/Plugin/HelpTopic/HelpTopicPluginInterface.php index 619a8e4d60..c40dbb2f33 100644 --- a/core/modules/help_topics/src/Plugin/HelpTopic/HelpTopicPluginInterface.php +++ b/core/modules/help_topics/src/Plugin/HelpTopic/HelpTopicPluginInterface.php @@ -8,22 +8,30 @@ /** * Defines an interface for help topic plugin classes. + * + * Help topics can be created by adding a help_topics folder to your module. + * Each help topic has a {topic_id}.help_topic.yml file and a corresponding twig + * template inside help_topics/templates. The twig file should be named + * help-topic-{topic-id}.html.twig, where {topic-id} is the topic ID used in the + * YAML file, with the underscores swapped for hyphens. For example: + * help_topics/basic_pages.help_topic.yml would have a corresponding + * help_topics/templates/help-topic-basic-pages.html.twig. */ interface HelpTopicPluginInterface extends PluginInspectionInterface, DerivativeInspectionInterface, CacheableDependencyInterface { /** - * Returns the translated label of the topic. + * Returns the label of the topic. * * @return string - * The label of the topic in a TranslatableMarkup object. + * The label of the topic. */ public function getLabel(); /** - * Returns the translated body of the topic. + * Returns the body of the topic. * - * @return string - * The HTML-formatted body of the topic in a TranslatableMarkup object. + * @return array + * A render array representing the body. */ public function getBody(); diff --git a/core/modules/help_topics/src/Plugin/HelpTopic/HelpTopicPluginManager.php b/core/modules/help_topics/src/Plugin/HelpTopic/HelpTopicPluginManager.php index c003babbcc..1e5f04e290 100644 --- a/core/modules/help_topics/src/Plugin/HelpTopic/HelpTopicPluginManager.php +++ b/core/modules/help_topics/src/Plugin/HelpTopic/HelpTopicPluginManager.php @@ -129,19 +129,6 @@ protected function getFactory() { return $this->factory; } - /** - * Checks to see if cached plugin definitions exist. - * If they do, then it returns the cached definitions. - * Otherwise, findDefinitions() is called. - * - * @see \Drupal\Core\Plugin\DefaultPluginManager::findDefinitions() - * - * @return array|\mixed[]|null - */ - public function getDefinitions() { - return parent::getDefinitions(); - } - /** * {@inheritdoc} */ @@ -201,7 +188,7 @@ public function getAllListOn($id) { $topics = []; foreach ($this->getDefinitions() as $definition) { - if (in_array($id, $definition['list_on'])) { + if (in_array($id, $definition['list_on'], TRUE)) { $topics[] = $this->createInstance($definition['id']); } }