Exposed variables to simplify theming process

Creating custom themes is very wasteful process at the moment, the reason being that we only have preprocessed variables to work with and we need to undo the processing to get the unprocessed (atomic) data underneath it all.

For example, if I wanted to create a custom theme to show the inline tax calculations, I don’t have the tax rates available. Instead, I need to undo the processing on the tax labels in the totals and in the lines and link the two just to be able to take an “educated guess” on what the line tax should be.

Another problem is that users need to create the same theme again and again for different languages or make the theme code ridiculously long in order for it to work in multiple languages. Even worse , any later changes to the translation will break the theme.

The cause of these two problems is the same: atomic pieces of information are not available for the theme developer.

We should at least have:

  1. Names and labels. Names are always in English and labels are based on display language. Names will not be shown in the final document but can be used by the theme developer. If we have this we can say goodbye to themes for specific languages and related problems with translation.

  2. Some sort of IDs for heavily processed data like tax codes in totals. Example would be that each total would have a label e.g. Includes: so and so and an id e.g. VAT 5%.

These two – at least – will not only make the themes shorter and easier but also reduce the wasted server time processing redundant liquid code just to get some basic info that should’ve been readily available to start with.

I appreciate if you break your silence @lubos on this because themes really need a lot of work.

4 Likes