public class Widget

class.widget.php #10

Widget is a utility class that offers a number miscellaneous of functions to help generate common HTML Forms elements as XMLElement objects for inclusion in Symphony backend pages.

Methods

static XMLElement Anchor()

Generates a XMLElement representation of <a>

Parameters
  • $value The text of the resulting <a>

  • $href The href attribute of the resulting <a>

  • $title (optional) The title attribute of the resulting <a>

  • $class (optional) The class attribute of the resulting <a>

  • $id (optional) The id attribute of the resulting <a>

  • $attributes (optional) Any additional attributes can be included in an associative array with the key being the name and the value being the value of the attribute. Attributes set from this array will override existing attributes set by previous params.

static XMLElement Form()

Generates a XMLElement representation of <form>

Parameters
  • $action The text of the resulting <form>

  • $method The method attribute of the resulting <form>. Defaults to "post".

  • $class (optional) The class attribute of the resulting <form>

  • $id (optional) The id attribute of the resulting <form>

  • $attributes (optional) Any additional attributes can be included in an associative array with the key being the name and the value being the value of the attribute. Attributes set from this array will override existing attributes set by previous params.

static XMLElement Input()

Generates a XMLElement representation of <input>

Parameters
  • $name The name attribute of the resulting <input>

  • $value (optional) The value attribute of the resulting <input>

  • $type The type attribute for this <input>, defaults to "text".

  • $attributes (optional) Any additional attributes can be included in an associative array with the key being the name and the value being the value of the attribute. Attributes set from this array will override existing attributes set by previous params.

static XMLElement Label()

Generates a XMLElement representation of <label>

Parameters
  • $name (optional) The text for the resulting <label>

  • $child (optional) An XMLElement that this

  • $class (optional) The class attribute of the resulting <label>

  • $id (optional) The id attribute of the resulting <label>

  • $attributes (optional) Any additional attributes can be included in an associative array with the key being the name and the value being the value of the attribute. Attributes set from this array will override existing attributes set by previous params.

static XMLElement Select()

Generates a XMLElement representation of a <select>. This uses the private function __SelectBuildOption() to build XMLElements of options given the $options array.

Parameters
  • $name The name attribute of the resulting <select>

  • $options (optional) An array containing the data for each <option> for this <select>. If the array is associative, it is assumed that <optgroups> are to be created, otherwise it's an array of the containing the option data. If no options are provided an empty <select> XMLElement is returned. array( array($value, $selected, $desc, $class, $id, $attr) ) array( array('label' => 'Optgroup', 'options' = array( array($value, $selected, $desc, $class, $id, $attr) ) )

  • $attributes (optional) Any additional attributes can be included in an associative array with the key being the name and the value being the value of the attribute. Attributes set from this array will override existing attributes set by previous params.

See Also
static XMLElement Table()

Generates a XMLElement representation of <table> This is a simple way to create generic Symphony table wrapper

Parameters
  • $header An XMLElement containing the <thead>. See Widget::TableHead

  • $footer An XMLElement containing the <tfoot>

  • $body An XMLElement containing the <tbody>. See Widget::TableBody

  • $class (optional) The class attribute of the resulting <table>

  • $id (optional) The id attribute of the resulting <table>

  • $attributes (optional) Any additional attributes can be included in an associative array with the key being the name and the value being the value of the attribute. Attributes set from this array will override existing attributes set by previous params.

static XMLElement TableBody()

Generates a XMLElement representation of <tbody> from an array containing <tr> XMLElements

Parameters
  • $rows An array of XMLElements of <tr>'s.

  • $class (optional) The class attribute of the resulting <tbody>

  • $id (optional) The id attribute of the resulting <tbody>

  • $attributes (optional) Any additional attributes can be included in an associative array with the key being the name and the value being the value of the attribute. Attributes set from this array will override existing attributes set by previous params.

See Also
static XMLElement TableData()

Generates a XMLElement representation of a <td>.

Parameters
  • $value Either an XMLElement object, or a string for the value of the resulting <td>

  • $class (optional) The class attribute of the resulting <td>

  • $id (optional) The id attribute of the resulting <td>

  • $colspan (optional) The colspan attribute of the resulting <td>

  • $attributes (optional) Any additional attributes can be included in an associative array with the key being the name and the value being the value of the attribute. Attributes set from this array will override existing attributes set by previous params.

static XMLElement TableHead()

Generates a XMLElement representation of <thead> from an array containing column names and any other attributes.

Parameters
  • $columns An array of column arrays, where the first item is the name of the column, the second is the scope attribute, and the third is an array of possible attributes. array( array('Column Name', 'scope', array('class'=>'th-class')) )

static XMLElement TableRow()

Generates a XMLElement representation of <tr> from an array containing column names and any other attributes.

Parameters
  • $cells An array of XMLElements of <td>'s. See Widget::TableData

  • $class (optional) The class attribute of the resulting <tr>

  • $id (optional) The id attribute of the resulting <tr>

  • $rowspan (optional) The rowspan attribute of the resulting <tr>

  • $attributes (optional) Any additional attributes can be included in an associative array with the key being the name and the value being the value of the attribute. Attributes set from this array will override existing attributes set by previous params.

static XMLElement Textarea()

Generates a XMLElement representation of <textarea>

Parameters
  • $name The name of the resulting <textarea>

  • $rows (optional) The height of the textarea, using the rows attribute. Defaults to 15

  • $cols (optional) The width of the textarea, using the cols attribute. Defaults to 50.

  • $value (optional) The content to be displayed inside the <textarea>

  • $attributes (optional) Any additional attributes can be included in an associative array with the key being the name and the value being the value of the attribute. Attributes set from this array will override existing attributes set by previous params.

static XMLElement wrapFormElementWithError()

Will wrap a <div> around a desired element to trigger the default Symphony error styling.

Parameters
  • $element The element that should be wrapped with an error

  • $message The text for this error. This will be appended after the $element, but inside the wrapping <div>

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details