Problem/Motivation

Namespaces can only be defined statically in .info.yml files. It would be nice if a module could dynamically define namespaces.

Proposed resolution

Add a module hook to define Twig namespaces dynamically.

API changes

Add hook_namespaces_alter().

Issue fork components-2909781

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

RobLoach created an issue. See original summary.

sonictruth’s picture

+1 this would be lovely.

johnalbin’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
johnalbin’s picture

Version: 8.x-2.x-dev » 3.x-dev

New features will need to go in Components 3.x.

johnalbin’s picture

Title: Add module hook to define Twig namespaces dynamically » Add alter hook to define Twig namespaces dynamically
Assigned: robloach » Unassigned
Category: Task » Feature request
Issue summary: View changes

Since the primary way to define namespaces is with .info.yml files, the most-natural way to add a hook would be as an alter hook of the namespaces defined in .info.yml.

johnalbin’s picture

Status: Active » Needs review

  • JohnAlbin committed 34df31d on 3.x
    Issue #2909781 by JohnAlbin: Add alter hook to define Twig namespaces...
johnalbin’s picture

Status: Needs review » Fixed
johnalbin’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.