P&T Radio Buttons

Configuration

P&T Radio Buttons has one setting, “Radio Button Options”, a single textarea in which you specify each radio option you want as part of the group.

List one option per line:

Herbie Hancock
Bob Dylan
The Bad Plus

You can optionally specify each option’s value separately from its label:

herbie : Herbie Hancock
bobby : Bob Dylan
tbp : The Bad Plus

Templates

Primary Tag

Calling your P&T Radio Buttons field with a single tag returns the selected option’s value:

<p>I really like {favorite_thing}.</p>

:label Tag

Returns the label of the selected option. (Only useful if you have specified the input values)

<p>I really like <a href="{favorite_thing}">{favorite_thing:label}</a>.</p>

:all_options Tag Pair

If you want to loop through each of your options, regardless of whether or not they’re selected, use this tag.

{favorite_thing:all_options}
  <p>I {if {selected} == ""}don’t{/if} really like {option}.</p>
{/favorite_thing:all_options}

Tag Parameters

The following tag parameters can be added to P&T Radio Buttons’s :all_options tag:

sort="asc|desc"
Sort the options in ascending or descending order
backspace=
Strip the last X characters from the tag output

Single Variable Tags

The following single variables are available within your :all_options tag pair:

{option}
The current option
{option_name}
If you specified a name for your option, this is how you access it. Otherwise, it will return the same thing as {option}.
{count}
The current option’s index
switch
Switch between multiple values based on the current option index
{selected}
For use in conditionals; returns “y” if the current option is selected