When you create a theme, you tell it which theme engine to use when rendering the theme. You do this in the theme's .info file:

name = My Nifty Theme
description = Some description of my nifty theme.
core = 7.x
engine = phptemplate

Although this is great, and allows us to switch which theme engine we want to use for our theme, it presents a problem when we want to use two or more different theme engines. What if, in our theme, we want to use Zengine, and Smarty? This would give us a very slick template engine with the power of Smarty, and the awesome base of Zengine.

How would we accomplish this? Instead of passing in a single "engine" value through the .info file, we would pass in an array:

engines[] = smarty
engines[] = zengine

If we don't specify an engines[] definition, it assume a default of engines[] = phptemplate.

Comments

dvessel’s picture

I think this is an interesting idea. The only problems I can foresee is each engine competing for theme functions and templates when they register the same hooks. It could work by processing based on the order it's set .info file.

There's also the extra overhead for templated hooks since there can be more preprocessors and whatever else each engine does.

robloach’s picture

Status: Active » Needs work
StatusFileSize
new6.97 KB

Kicking it off... ETS and Bluemarine ETS are good testing grounds.

cwgordon7’s picture

This is great but in order to be truly awesome color.module needs to be turned into a theme engine.

robloach’s picture

Title: Allow Multiple Theme Engines » Theme Engines as Modules

What if we went the other way around and made theme engines modules? phpTemplate would become a module that themes would depend on. Enabling a theme that used both Awesomengine and phpTemplate would enable those modules.

casey’s picture

Version: 7.x-dev » 8.x-dev

+1 on theme engines being modules.

Hopefully in D8...

robloach’s picture

robloach’s picture

Status: Postponed » Needs review

Doesn't need to be postponed. This moves themes/engines/phptemplate.engine over to modules/system/phptemplate.engine.... Essentially it moves theme engines over to modules.

robloach’s picture

StatusFileSize
new4.49 KB
robloach’s picture

#8: themeenginesasmodules.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, themeenginesasmodules.patch, failed testing.

robloach’s picture

Status: Needs work » Needs review
StatusFileSize
new239 bytes
robloach’s picture

StatusFileSize
new2.31 KB

Wrong patch... Here's the right one.

fabianx’s picture

Status: Needs review » Needs work

This won't enable the engine when the module is enabled unfortunately as there is too much other engine specific code going on.

It's really difficult to support two engines within one module how it is structured currently. (and I tried that first as well)

sun’s picture

Issue summary: View changes
Status: Needs work » Closed (duplicate)

Since theme engines are not installed or enabled in any way, #1685492: Convert theme engines into services is the much more appropriate answer.