Follow-up to #2168231: Twig Functions needed in templates

Problem/Motivation

There may be some variables that all your themes need to use. Example base_path().

Letting themes provide these global variables instead of having to make a module.

When this was added all alter hooks ran for themes and it was documented that themes were able to use this: https://www.drupal.org/node/1838470

Proposed resolution

Add ThemeHandeler->alter() to _template_preprocess_default_variables()

User interface changes

N/A

API changes

N/A

Comments

joelpittet created an issue. See original summary.

joelpittet’s picture

Status: Active » Needs review
FileSize
715 bytes
Cottser’s picture

Title: Global template variables should be able alter() from themes. » Themes should be able to alter global template variables
Category: Plan » Task
Issue tags: +Needs tests

More active title :)

Probably could use a little test I think?

Status: Needs review » Needs work

The last submitted patch, 2: global_template-2612196-2.patch, failed testing.

joelpittet’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
3.72 KB

Tests and working code:) Will still fail because I don't know how to test the active theme very well... or it's not working.

Status: Needs review » Needs work

The last submitted patch, 5: themes_should_be_able-2612196-5.patch, failed testing.

Cottser’s picture

Issue summary: View changes

Added reference to https://www.drupal.org/node/1838470 to the IS.

xjm’s picture

Issue tags: -rc target triage

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.