symfony API

sfWidgetForm Class

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to API menu

1.1 API OpenSearch

Packages

You are currently browsing the symfony API for the 1.1 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.

sfWidgetForm is the base class for all form widgets.

Method Summary

  • array fixFormId($attributes)
    Adds an HTML id attributes to the array of attributes if none is given and a name attribute exists.
  • string generateId($name, $value)
    Returns a formatted id based on the field name and optionally on the field value.
  • array generateTwoCharsRange($start, $stop)
    Generates a two chars range
  • string getIdFormat()
    Gets the HTML format string for id attributes.
  • Boolean isHidden()
    Returns true if the widget is hidden.
  • bool needsMultipartForm()
    Returns true if the widget needs a multipart form.
  • string renderContentTag($tag, $content, $attributes)
    Renders a HTML content tag.
  • string renderTag(, )
    Renders a HTML tag.
  • setHidden($boolean)
    Sets the hidden flag for the widget.
  • setIdFormat($format)
    Sets the format for HTML id attributes.
  • __construct($options, $attributes)
    Constructor.

Methods inherited from sfWidget

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

Method Details

  • (array) fixFormId ($attributes) Browse code

    $attributes An array of attributes

    Adds an HTML id attributes to the array of attributes if none is given and a name attribute exists.

    returns An array of attributes with an id.

  • (string) generateId ($name, $value) Browse code

    $name The field name
    $value The field value

    Returns a formatted id based on the field name and optionally on the field value.


    This function determines the proper form field id name based on the parameters. If a form field has an
    array value as a name we need to convert them to proper and unique ids like so:


    name[] => name (if value == null)
    name[] => name_value (if value != null)
    name[bob] => name_bob
    name[item][total] => name_item_total

    returns The field id or null.

  • (array) generateTwoCharsRange ($start, $stop) Browse code

    Generates a two chars range

  • (string) getIdFormat () Browse code

    Gets the HTML format string for id attributes.

    returns The format string

  • (Boolean) isHidden () Browse code

    Returns true if the widget is hidden.

    returns true if the widget is hidden, false otherwise

  • (bool) needsMultipartForm () Browse code

    Returns true if the widget needs a multipart form.

    returns true if the widget needs a multipart form, false otherwise

  • (string) renderContentTag ($tag, $content, $attributes) Browse code

    $tag The tag name
    $content The content of the tag
    $attributes An array of HTML attributes to be merged with the default HTML attributes

    Renders a HTML content tag.


    The id attribute is added automatically to the array of attributes if none is specified.
    If uses for "id_format" option to generate the id.

    returns An HTML tag string

  • (string) renderTag (, ) Browse code

    Renders a HTML tag.


    The id attribute is added automatically to the array of attributes if none is specified.
    If uses for "id_format" option to generate the id.

    returns An HTML tag string

  • setHidden ($boolean) Browse code

    $boolean true if the widget must be hidden, false otherwise

    Sets the hidden flag for the widget.

  • setIdFormat ($format) Browse code

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

    Sets the format for HTML id attributes.

  • __construct ($options, $attributes) Browse code

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

    Constructor.


    Available options:

    * id_format: The format for the generated HTML id attributes (%s by default)
    * is_hidden: true if the form widget must be hidden, false otherwise (false by default)
    * needs_multipart: true if the form widget needs a multipart form, false otherwise (false by default)