Helpers Form Functions

Functions

countries_select_for_form($title = '', $default_value = NULL, $required = FALSE, $description = '', $multiple = FALSE)

Build a form-structure filled with countries; this can be used in a select list.

  • Calling parameters
  • $title
    the title of the form. Defaults to "Countries" (translated). If provided, it will not be translated.
    $default_value
    the selected country.
    $required
    whether or not a "none" string should be included in the options.
    $description
    optionally provide a description. Is not translated.
    $multiple
    whether or not to allow multiple choices.
  • Return
  • A completed form element ready to be used.

states_select_for_form($title = '', $default_value = NULL, $required = FALSE, $description = '', $multiple = FALSE)

  • Calling parameters
  • $title
    the title of the form. Defaults to "States" (translated). If provided, it will not be translated.
    $default_value
    the selected state.
    $required
    whether or not a "none" string should be included in the options.
    $description
    optionally provide a description. Is not translated.
    $multiple
    whether or not to allow multiple choices.
  • Return
  • A completed form element ready to be used.

month_select_for_form($title = '', $default_value = NULL, $required = FALSE, $description = '', $multiple = FALSE)

  • Calling parameters
  • $title
    the title of the form. Defaults to "Month" (translated). If provided, it will not be translated.
    $default_value
    the selected month.
    $required
    whether or not a "none" string should be included in the options.
    $description
    optionally provide a description. If provided, it will not be translated.
    $multiple
    whether or not to allow multiple choices.
  • Return
  • A completed form element ready to be used.

year_select_for_form($range = 10, $start = 'current', $title = '', $default_value = NULL, $required = FALSE, $description = '', $multiple = FALSE)

  • Calling parameters
  • $range
    The number of years to show from the specified starting year. If this value is negative, then only use the number of years before. If it is positive, then show the number of years before and after.
    $start
    The year to start the list with. If specified (or defaulted) as "current" then, use the current year.
    $title
    The title of the form element. Defaults to "Year" (translated). If provided, it will not be translated.
    $default_value
    The selected year.
    $required
    Whether or not a "none" string should be included in the options.
    $description
    Optionally provide a description. If provided, it will not be translated.
    $multiple
    whether or not to allow multiple choices.
  • Return
  • A completed form element ready to be used.

add_none_to_options($options, $none_string = NULL)

Add a "None" option to an option list.

  • Calling parameters
  • $options
    the options to which you want to append "None."
    $none_string
    Optional string that will be the "none". If you provide this, it will not be translated and not passed trough the themeFor web sites, this refers to the "look and feel" of the site. It is also used to describe the code to produce that look. layer.
  • Return
  • A modified options list with the None option added.