Questions tagged [dry]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
37 views

DRY variable setting across templates (macro for variable?)

I have a need for something like the following: {# Template A #} {# Do X that sets variable x #} {# Do Y that sets variable y #} {# Pass x and y into A include partials #} {# Template B #}...
1
vote
0answers
96 views

I'm repeatedly setting the same variables. How to reuse code block to make this DRY?

I have a very complex layout which is requiring me to have quite a few {% for %} loops on the page and in each loop I need to set a bunch of variables. In order to make my template more DRY I was ...
0
votes
0answers
54 views

Error Icon and DRYer Code

I currently have the following code as part of the address form in Craft Commerce. <label class="label" for="{{ modelName }}-firstName">First Name (*)</label> <input ...
1
vote
1answer
72 views

Logistics of loose field naming and re-use with Relabel

Relabel certainly seems quite useful in being able to apply a more generic use to fields. The more I use it the more I see a use case for just creating a generic field with the same name as it's ...
2
votes
1answer
696 views

Possible to re-use one field multiple times in a section?

This seems like it should be possible but I may be missing a trick. Is it possible to use a single field multiple times in a section? So, for example, if you have a simple 'text' field and you want ...