Create TemplateDiscovery for plugin managers to use

Created on 16 August 2019, over 5 years ago
Updated 31 January 2023, almost 2 years ago

Problem/Motivation

#3064854: Allow Twig templates to use front matter for metadata support introduced the ability for templates to provide metadata using front matter.

This can potentially allow plugin managers that associate plugin definitions with templates (examples: layouts, help_topics) to inline the plugin definition with the template itself. Otherwise, you would need to put definitions into separate files and discover them using YamlDiscovery.

Proposed resolution

Introduce a new TemplateDiscovery abstract class that can be extended to discover plugins from Twig templates.

Use the template filename as the plugin ID, and allow extending classes to define what to do with extracted FrontMatter metadata.

Remaining tasks

User interface changes

None

API changes

New API will be introduced; no changes to existing APIs.

Data model changes

None

Release notes snippet

A new plugin discovery method has been added that discovers plugins in Twig templates. See https://www.drupal.org/node/3212845 for more information.

📌 Task
Status

Needs review

Version

10.1

Component
Theme 

Last updated about 13 hours ago

Created by

🇺🇸United States markhalliwell

Live updates comments and jobs are added and updated live.
  • Needs subsystem maintainer review

    It is used to alert the maintainer(s) of a particular core subsystem that an issue significantly impacts their subsystem, and their signoff is needed (see the governance policy draft for more information). Also, if you use this tag, make sure the issue component is set to the correct subsystem. If an issue significantly impacts more than one subsystem, use needs framework manager review instead.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024