function FormatterBase::__construct

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Field/FormatterBase.php \Drupal\Core\Field\FormatterBase::__construct()
  2. 10 core/lib/Drupal/Core/Field/FormatterBase.php \Drupal\Core\Field\FormatterBase::__construct()
  3. 11.x core/lib/Drupal/Core/Field/FormatterBase.php \Drupal\Core\Field\FormatterBase::__construct()

Constructs a FormatterBase object.

Parameters

string $plugin_id: The plugin_id for the formatter.

mixed $plugin_definition: The plugin implementation definition.

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The definition of the field to which the formatter is associated.

array $settings: The formatter settings.

string $label: The formatter label display setting.

string $view_mode: The view mode.

array $third_party_settings: Any third party settings.

13 calls to FormatterBase::__construct()
BaseFieldFileFormatterBase::__construct in core/modules/file/src/Plugin/Field/FieldFormatter/BaseFieldFileFormatterBase.php
Constructs a BaseFieldFileFormatterBase object.
CommentDefaultFormatter::__construct in core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
Constructs a new CommentDefaultFormatter.
ContentModerationStateFormatter::__construct in core/modules/content_moderation/src/Plugin/Field/FieldFormatter/ContentModerationStateFormatter.php
Create an instance of ContentModerationStateFormatter.
DateTimeFormatterBase::__construct in core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php
Constructs a new DateTimeDefaultFormatter.
EntityReferenceEntityFormatter::__construct in core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
Constructs an EntityReferenceEntityFormatter instance.

... See full list

13 methods override FormatterBase::__construct()
BaseFieldFileFormatterBase::__construct in core/modules/file/src/Plugin/Field/FieldFormatter/BaseFieldFileFormatterBase.php
Constructs a BaseFieldFileFormatterBase object.
CommentDefaultFormatter::__construct in core/modules/comment/src/Plugin/Field/FieldFormatter/CommentDefaultFormatter.php
Constructs a new CommentDefaultFormatter.
ContentModerationStateFormatter::__construct in core/modules/content_moderation/src/Plugin/Field/FieldFormatter/ContentModerationStateFormatter.php
Create an instance of ContentModerationStateFormatter.
DateTimeFormatterBase::__construct in core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php
Constructs a new DateTimeDefaultFormatter.
EntityReferenceEntityFormatter::__construct in core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
Constructs an EntityReferenceEntityFormatter instance.

... See full list

File

core/lib/Drupal/Core/Field/FormatterBase.php, line 64

Class

FormatterBase
Base class for 'Field formatter' plugin implementations.

Namespace

Drupal\Core\Field

Code

public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings) {
    parent::__construct([], $plugin_id, $plugin_definition);
    $this->fieldDefinition = $field_definition;
    $this->settings = $settings;
    $this->label = $label;
    $this->viewMode = $view_mode;
    $this->thirdPartySettings = $third_party_settings;
}

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