You are here

public function IngredientFormatter::__construct in Recipe 8.2

Constructs a IngredientFormatter service.

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.

\Drupal\ingredient\Utility\IngredientUnitUtility $ingredient_unit_utility: The ingredient.unit service.

\Drupal\ingredient\Utility\IngredientQuantityUtility $ingredient_quantity_utility: The ingredient.quantity service.

Overrides FormatterBase::__construct

File

modules/ingredient/src/Plugin/Field/FieldFormatter/IngredientFormatter.php, line 64

Class

IngredientFormatter
Plugin implementation of the 'ingredient_default' formatter.

Namespace

Drupal\ingredient\Plugin\Field\FieldFormatter

Code

public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, IngredientUnitUtility $ingredient_unit_utility, IngredientQuantityUtility $ingredient_quantity_utility) {
  parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings);
  $this->ingredientUnitUtility = $ingredient_unit_utility;
  $this->ingredientQuantityUtility = $ingredient_quantity_utility;
}