You are here

public function ExampleMeatballSandwich::__construct in Examples for Developers 3.x

Same name and namespace in other branches
  1. 8 plugin_type_example/src/Plugin/Sandwich/ExampleMeatballSandwich.php \Drupal\plugin_type_example\Plugin\Sandwich\ExampleMeatballSandwich::__construct()

Constructs a \Drupal\Component\Plugin\PluginBase object.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

Overrides PluginBase::__construct

File

modules/plugin_type_example/src/Plugin/Sandwich/ExampleMeatballSandwich.php, line 76

Class

ExampleMeatballSandwich
Provides a meatball sandwich.

Namespace

Drupal\plugin_type_example\Plugin\Sandwich

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, TranslationInterface $translation) {

  // Store the translation service.
  $this
    ->setStringTranslation($translation);

  // Store the day so we can generate a special description on Sundays.
  $this->day = date('D');

  // Pass the other parameters up to the parent constructor.
  parent::__construct($configuration, $plugin_id, $plugin_definition);
}