OOUI\FlaggedElement Class Reference

Element with named flags that can be added, removed, listed and checked. More...

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

## Public Member Functions

| __construct (Element $element, array $config=array())
| hasFlag ($flag)
| Check if a flag is set. More...
| getFlags ()
| Get the names of all flags set. More...
| clearFlags ()
| Clear all flags. More...
| setFlags ($flags)
| Add one or more flags. More...
| getConfig (&$config)
Public Member Functions inherited from OOUI\ElementMixin
| __construct (Element $element, Tag $target, array $config=array())
| Create element. More...
| getConfig (&$config)
| Add properties to the given `$config` array to allow reconstruction of this widget via its constructor. More...

## Static Public Attributes

static | $targetPropertyName = 'flagged'
Static Public Attributes inherited from OOUI\ElementMixin
static string | $targetPropertyName = ''
| Property name for accessing the target on the element.

## Protected Attributes

string[] | $flags = array()
| Flags.
Protected Attributes inherited from OOUI\ElementMixin
Element | $element = null
| Element being mixed into.

## Additional Inherited Members

Public Attributes inherited from OOUI\ElementMixin
Tag | $target = null
| Tag being targeted.

## Detailed Description

Element with named flags that can be added, removed, listed and checked.

A flag, when set, adds a CSS class on the `$element` by combining `oo-ui-flaggedElement-` with the flag name. Flags are primarily useful for styling.

## Constructor & Destructor Documentation

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

Parameters

  Element | $element | Element being mixed into
  array | $config | Configuration options
  | string|string[] | $config['flags'] Flags describing importance and functionality, e.g. 'primary', 'safe', 'progressive', 'destructive' or 'constructive'

## Member Function Documentation

OOUI\FlaggedElement::clearFlags | ( |  | ) |

Clear all flags.

Returns
  $this

OOUI\FlaggedElement::getFlags | ( |  | ) |

Get the names of all flags set.

Returns
  string[] Flag names

OOUI\FlaggedElement::hasFlag | ( |  | $flag | ) |

Check if a flag is set.

Parameters

  string | $flag | Name of flag

Returns
  boolean Has flag

OOUI\FlaggedElement::setFlags | ( |  | $flags | ) |

Add one or more flags.

Parameters

  string | array | $flags | One or more flags to add, or an array keyed by flag name containing boolean set/remove instructions.

Returns
  $this

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

- php/mixins/FlaggedElement.php