Page 1 of 1

Change number of checkbox columns

PostPosted: Fri Jan 07, 2011 8:22 am
by ururk
Is it possible (with a setting) to change the number of columns displayed? I'd like to switch it to 2 columns, from three. I poked through the php files, but haven't found where this is set. Ideally I'd not be making a core change.

Re: Change number of checkbox columns

PostPosted: Mon Jan 10, 2011 11:07 pm
by ururk
I solved this problem:

Edit line 128 (or thereabouts) in this template file:

Dataface_Form_Section_Template.html

Original:
Code: Select all
{if $element.field.widget.columns}{assign var=cols value=$element.field.widget.columns}{else}{assign var=cols value=3}{/if}


Change to:
Code: Select all
{if $element.field.widget.columns}{assign var=cols value=$element.field.widget.columns}{else}{assign var=cols value=2}{/if}


This looks to be a global change, so it might not work out if you want to target specific elements (though I'm guessing SMARTY provides the ability to target specific columns through an if statement).

Re: Change number of checkbox columns

PostPosted: Fri Jan 14, 2011 12:59 pm
by shannah
As you can tell from this snippet, another way to do this on a field by field basis would be to set the widget:columns directive in the fields.ini file:
Code: Select all
widget:columns=2

Re: Change number of checkbox columns

PostPosted: Fri Jan 14, 2011 6:28 pm
by ururk
shannah wrote:As you can tell from this snippet, another way to do this on a field by field basis would be to set the widget:columns directive in the fields.ini file:

Ah, I like that method much better. I've started to delve a bit into the templates, but have never used SMARTY before.