Constructs a FormatterBase object.
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
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;
}