public function FormatterBase::__construct

Constructs a FormatterBase object.

Parameters

string $plugin_id: The plugin_id for the formatter.

array $plugin_definition: The plugin implementation definition.

\Drupal\field\Plugin\Core\Entity\FieldInstance $instance: The field instance to which the formatter is associated.

array $settings: The formatter settings.

string $label: The formatter label display setting.

string $view_mode: The view mode.

Overrides PluginBase::__construct

File

drupal/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterBase.php, line 70
Definition of Drupal\field\Plugin\Type\Formatter\FormatterBase.

Class

FormatterBase
Base class for 'Field formatter' plugin implementations.

Namespace

Drupal\field\Plugin\Type\Formatter

Code

public function __construct($plugin_id, array $plugin_definition, $instance, array $settings, $label, $view_mode) {
  parent::__construct(array(), $plugin_id, $plugin_definition);
  $this->instance = $instance;
  $this->field = field_info_field($instance['field_name']);
  $this->settings = $settings;
  $this->label = $label;
  $this->viewMode = $view_mode;
}