symfony API

sfWidgetFormChoice Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

Packages

You are currently browsing the symfony API for the 1.4 version. Switch to:
This version of symfony is not maintained anymore.
If some of your projects still use this version, consider upgrading as soon as possible.

sfWidgetFormChoice represents a choice widget.

Method Summary

  • configure($options, $attributes)
    Constructor.
  • array getJavaScripts()
    Gets the JavaScript paths associated with the widget.
  • getRenderer()
  • array getStylesheets()
    Gets the stylesheet paths associated with the widget.
  • string render($name, $value, $attributes, $errors)
    Renders the widget.
  • setIdFormat($format)
    Sets the format for HTML id attributes. This is made avaiable to the renderer,

Methods inherited from sfWidgetFormChoiceBase

configure , getChoices , __clone

Methods inherited from sfWidgetForm

fixFormId , generateId , generateTwoCharsRange , getDefault , getIdFormat , getLabel , getParent , isHidden , needsMultipartForm , renderContentTag , renderTag , setDefault , setHidden , setIdFormat , setLabel , setParent , translate , translateAll , __construct

Methods inherited from sfWidget

addOption , addRequiredOption , attributesToHtml , attributesToHtmlCallback , configure , escapeOnce , fixDoubleEscape , getAttribute , getAttributes , getCharset , getJavaScripts , getOption , getOptions , getRequiredOptions , getStylesheets , hasOption , isXhtml , render , renderContentTag , renderTag , setAttribute , setAttributes , setCharset , setOption , setOptions , setXhtml , __construct

Method Details

  • configure ($options, $attributes)

    $options An array of options
    $attributes An array of default HTML attributes

    Constructor.


    Available options:

    * choices: An array of possible choices (required)
    * multiple: true if the select tag must allow multiple selections
    * expanded: true to display an expanded widget
    if expanded is false, then the widget will be a select
    if expanded is true and multiple is false, then the widget will be a list of radio
    if expanded is true and multiple is true, then the widget will be a list of checkbox
    * renderer_class: The class to use instead of the default ones
    * renderer_options: The options to pass to the renderer constructor
    * renderer: A renderer widget (overrides the expanded and renderer_options options)
    The choices option must be: new sfCallable($thisWidgetInstance, 'getChoices')

  • (array) getJavaScripts ()

    Gets the JavaScript paths associated with the widget.

    returns An array of JavaScript paths

  • getRenderer ()

  • (array) getStylesheets ()

    Gets the stylesheet paths associated with the widget.

    returns An array of stylesheet paths

  • (string) render ($name, $value, $attributes, $errors)

    $name The element name
    $value The value selected in this widget
    $attributes An array of HTML attributes to be merged with the default HTML attributes
    $errors An array of errors for the field

    Renders the widget.

    returns An HTML tag string

  • setIdFormat ($format)

    $format The format string (must contain a %s for the id placeholder)

    Sets the format for HTML id attributes. This is made avaiable to the renderer,

    as this widget does not render itself, but delegates to the renderer instead.