P&T Dropdown

Configuration

P&T Dropdown has one setting, “Dropdown Options”, a single textarea in which you specify your select’s options.

List one option per line:

Herbie Hancock
Miles Davis
The Beatles
Bob Dylan

You can optionally specify input values for each option, and organize options into optgroups:

Jazz
    herbie : Herbie Hancock
    miles : Miles Davis
Rock
    beatles : The Beatles
    bobby : Bob Dylan

You can also create a blank option by adding a blank line at the top. Or give the blank option a label:

 : Select one...

(Note there’s a space before the colon.)

Templates

Primary Tag

Calling your P&T Dropdown 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 Dropdown’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