function FieldFormatter::__construct

Same name in other branches
  1. 10 core/lib/Drupal/Core/Field/Attribute/FieldFormatter.php \Drupal\Core\Field\Attribute\FieldFormatter::__construct()

Constructs a FieldFormatter attribute.

Parameters

string $id: The plugin ID.

\Drupal\Core\StringTranslation\TranslatableMarkup|null $label: (optional) The human-readable name of the formatter type.

\Drupal\Core\StringTranslation\TranslatableMarkup|null $description: (optional) A short description of the formatter type.

string[] $field_types: (optional) An array of field types the formatter supports.

int|null $weight: (optional) An integer to determine the weight of this formatter. Weight is relative to other formatters in the Field UI when selecting a formatter for a given field instance.

class-string|null $deriver: (optional) The deriver class.

Overrides Plugin::__construct

File

core/lib/Drupal/Core/Field/Attribute/FieldFormatter.php, line 45

Class

FieldFormatter
Defines a FieldFormatter attribute for plugin discovery.

Namespace

Drupal\Core\Field\Attribute

Code

public function __construct(string $id, ?TranslatableMarkup $label = NULL, ?TranslatableMarkup $description = NULL, array $field_types = [], ?int $weight = NULL, ?string $deriver = NULL) {
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.