public function FormatterBase::__construct

Constructs a FormatterBase object.

Parameters

string $plugin_id: The plugin_id for the formatter.

Drupal\Component\Plugin\Discovery\DiscoveryInterface $discovery: The Discovery class that holds access to the formatter implementation definition.

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

array $settings: The formatter settings.

int $weight: The formatter weight.

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 81
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, DiscoveryInterface $discovery, $instance, array $settings, $weight, $label, $view_mode) {
  parent::__construct(array(), $plugin_id, $discovery);
  $this->instance = $instance;
  $this->field = field_info_field($instance['field_name']);
  $this->settings = $settings;
  $this->weight = $weight;
  $this->label = $label;
  $this->viewMode = $view_mode;
}