class FieldWidget extends Plugin (View source)

Defines a FieldWidget annotation object.

Widgets handle how fields are displayed in edit forms.

Additional annotation keys for widgets can be defined in hook_field_widget_info_alter().

Properties

protected array $definition

The plugin definition read from the class annotation.

from  Plugin
string $id

The plugin ID.

Translation $label

The human-readable name of the widget type.

Translation $description

A short description of the widget type.

string $class

The name of the widget class.

array $field_types

An array of field types the widget supports.

bool $multiple_values

Does the field widget handles multiple values at once.

int $weight

An integer to determine the weight of this widget relative to other widgets in the Field UI when selecting a widget for a given field.

Methods

__construct($values)

Constructs a Plugin object.

from  Plugin
array
parse(array $values)

Parses an annotation into its definition.

from  Plugin
get()

Gets the value of an annotation.

from  Plugin
string
getProvider()

Gets the name of the provider of the annotated class.

from  Plugin
setProvider(string $provider)

Sets the name of the provider of the annotated class.

from  Plugin
string
getId()

Gets the unique ID for this annotated class.

from  Plugin
string
getClass()

Gets the class of the annotated class.

from  Plugin
setClass(string $class)

Sets the class of the annotated class.

from  Plugin

Details

__construct($values)

Constructs a Plugin object.

Builds up the plugin definition and invokes the get() method for any classed annotations that were used.

Parameters

$values

protected array parse(array $values)

Parses an annotation into its definition.

Parameters

array $values

The annotation array.

Return Value

array

The parsed annotation as a definition.

get()

Gets the value of an annotation.

string getProvider()

Gets the name of the provider of the annotated class.

Return Value

string

setProvider(string $provider)

Sets the name of the provider of the annotated class.

Parameters

string $provider

The provider of the annotated class.

string getId()

Gets the unique ID for this annotated class.

Return Value

string

string getClass()

Gets the class of the annotated class.

Return Value

string

setClass(string $class)

Sets the class of the annotated class.

Parameters

string $class

The class of the annotated class.