OOUI\Element Class Reference

DOM element abstraction. More...

Inheritance diagram for OOUI\Element:
[legend]
Collaboration diagram for OOUI\Element:
[legend]

## Public Member Functions

| __construct (array $config=array())
| __call ($method, $arguments)
| Call a mixed-in method. More...
| __get ($name)
| Get a mixed-in target property. More...
| __isset ($name)
| Check for existence of a mixed-in target property. More...
| getTagName ()
| Get the HTML tag name. More...
| getData ()
| Get element data. More...
| setData ($data)
| Set element data. More...
| supports ($methods)
| Check if element supports one or more methods. More...
| mixin (ElementMixin $mixin)
| Mixin a class. More...
| getConfig (&$config)
| Add the necessary properties to the given `$config` array to allow reconstruction of this widget via its constructor. More...
| toString ()
| Render element into HTML. More...
Public Member Functions inherited from OOUI\Tag
| __construct ($tag= 'div')
| Create element. More...
| hasClass ($class)
| Check for CSS class. More...
| addClasses (array $classes)
| Add CSS classes. More...
| removeClasses (array $classes)
| Remove CSS classes. More...
| toggleClasses (array $classes, $toggle=null)
| Toggle CSS classes. More...
| getAttribute ($key)
| Get HTML attribute value. More...
| setAttributes (array $attributes)
| Add HTML attributes. More...
| setValue ($value)
| Set value of input element ('value' attribute for most, element content for textarea). More...
| removeAttributes (array $keys)
| Remove HTML attributes. More...
| appendContent ()
| Add content to the end. More...
| prependContent ()
| Add content to the beginning. More...
| clearContent ()
| Remove all content. More...
| getElementGroup ()
| Get group element is in. More...
| setElementGroup ($group)
| Set group element is in. More...
| setInfusable ($infusable)
| Enable widget for client-side infusion. More...
| isInfusable ()
| Get client-side infusability. More...
| ensureInfusableId ()
| Ensure that this given Tag is infusable and has a unique `id` attribute. More...
| toString ()
| Render element into HTML. More...
| __toString ()
| Magic method implementation. More...

## Static Public Member Functions

static | getDir (Tag $element)
| Get the direction of the user interface for a given element. More...
static | setDefaultDir ($dir)
| Set the default direction of the user interface. More...

## Static Public Attributes

static string | $tagName = 'div'
| HTML tag name. More...
static string | $defaultDir = 'ltr'
| Default text direction, used for some layout calculations. More...

## Protected Member Functions

| getJavaScriptClassName ()
| The class name of the JavaScript version of this widget. More...
| getGeneratedAttributes ()
Protected Member Functions inherited from OOUI\Tag
| getGeneratedAttributes ()
| Return an augmented `attributes` array, including synthetic attributes which are created from other properties (like the `classes` array) but which shouldn't be retained in the user-visible `attributes`. More...

## Protected Attributes

mixed | $data = null
| Element data.
array | $ownClasses = array()
| Strings of the CSS classes explicitly configured for this element (as opposed to $classes, which contains all classes for this element).
array | $mixins = array()
| ElementMixins. More...
Protected Attributes inherited from OOUI\Tag
string | $tag = ''
| Tag name for this instance. More...
array | $attributes = array()
| Attributes. More...
array | $classes = array()
| Classes. More...
array | $content = array()
| Content. More...
GroupElement null | $elementGroup = null
| Group. More...
boolean | $infusable = false
| Infusion support. More...

## Detailed Description

DOM element abstraction.

## Constructor & Destructor Documentation

OOUI\Element::__construct | ( | array | $config = `array()` | ) |

Parameters

  array | $config | Configuration options
  | string[] | $config['classes'] CSS class names to add
  string | $config,['id'] | HTML id attribute
  string | $config,['text'] | Text to insert
  array | $config,['content'] | Content to append (after text), strings or Element objects. Strings will be HTML-escaped for output, use an HtmlSnippet instance to prevent that.
  mixed | $config,['data'] | Element data

## Member Function Documentation

OOUI\Element::__call | ( |  | $method,
|  |  | $arguments
| ) |  |

Call a mixed-in method.

This makes the methods of a mixin accessible through the element being mixed into.

Triggers an error if the method is not found, as normal.

Parameters

  string | $method | Method name
  array | $arguments | Method arguments

Returns
  mixed Result of method call

OOUI\Element::__get | ( |  | $name | ) |

Get a mixed-in target property.

This makes the target of a mixin accessible through the element being mixed into.

The target's property name is statically configured by the mixin class.

Triggers a notice if the property is not found, as normal.

Parameters

  string | $name | Property name

Returns
  Tag|null Target property or null if not found

OOUI\Element::__isset | ( |  | $name | ) |

Check for existence of a mixed-in target property.

Parameters

  string | $name | Property name

Returns
  bool Whether property exists

OOUI\Element::getConfig | ( | & | $config | ) |

Add the necessary properties to the given `$config` array to allow reconstruction of this widget via its constructor.

Parameters

  array | &$config | An array which will be mutated to add the necessary configuration properties. Unless you are implementing a subclass, you should always pass a new empty `array()`.

Returns
  array A configuration array which can be passed to this object's constructor to recreate it. This is a return value to allow the safe use of copy-by-value functions like `array_merge` in the implementation.

OOUI\Element::getData | ( |  | ) |

Get element data.

Returns
  mixed Element data

static OOUI\Element::getDir | ( | Tag | $element | ) |

static

Get the direction of the user interface for a given element.

Currently only per-document directionality is supported.

Parameters

  Tag | $element | Element to check

Returns
  string Text direction, either 'ltr' or 'rtl'

OOUI\Element::getJavaScriptClassName | ( |  | ) |

protected

The class name of the JavaScript version of this widget.

Returns
  string

OOUI\Element::getTagName | ( |  | ) |

Get the HTML tag name.

Override this method to base the result on instance information.

Returns
  string HTML tag name

OOUI\Element::mixin | ( | ElementMixin | $mixin | ) |

Mixin a class.

Parameters

  ElementMixin | $mixin | Mixin object

OOUI\Element::setData | ( |  | $data | ) |

Set element data.

Parameters

  mixed | $data | Element data

Returns
  $this

static OOUI\Element::setDefaultDir | ( |  | $dir | ) |

static

Set the default direction of the user interface.

Returns
  string Text direction, either 'ltr' or 'rtl'

OOUI\Element::supports | ( |  | $methods | ) |

Check if element supports one or more methods.

Parameters

  string|string[] | $methods Method or list of methods to check

Returns
  boolean All methods are supported

OOUI\Element::toString | ( |  | ) |

Render element into HTML.

Returns
  string HTML serialization

## Member Data Documentation

string OOUI\Element::$defaultDir = 'ltr'

static

Default text direction, used for some layout calculations.

Use setDefaultDir() to change.

Currently only per-document directionality is supported.

array OOUI\Element::$mixins = array()

protected

ElementMixins.

List mixed in objects.

string OOUI\Element::$tagName = 'div'

static

HTML tag name.

This may be ignored if getTagName() is overridden.

The documentation for this class was generated from the following file:

- php/Element.php