You are here

public function WeatherSystemDisplayBlock::__construct in Weather 2.0.x

Same name in this branch
  1. 2.0.x src/Plugin/Derivative/WeatherSystemDisplayBlock.php \Drupal\weather\Plugin\Derivative\WeatherSystemDisplayBlock::__construct()
  2. 2.0.x src/Plugin/Block/WeatherSystemDisplayBlock.php \Drupal\weather\Plugin\Block\WeatherSystemDisplayBlock::__construct()
Same name and namespace in other branches
  1. 8 src/Plugin/Block/WeatherSystemDisplayBlock.php \Drupal\weather\Plugin\Block\WeatherSystemDisplayBlock::__construct()

WeatherSystemDisplayBlock constructor.

Parameters

array $configuration: The plugin configuration.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

\Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager: Entity Type Manager service.

\Drupal\Core\Session\AccountProxyInterface $currentUser: Current user.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

Overrides BlockPluginTrait::__construct

File

src/Plugin/Block/WeatherSystemDisplayBlock.php, line 44

Class

WeatherSystemDisplayBlock
Provides a 'WeatherSystemDisplayBlock' block plugin.

Namespace

Drupal\weather\Plugin\Block

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entityTypeManager, AccountProxyInterface $currentUser) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->weatherDisplay = $entityTypeManager
    ->getStorage('weather_display')
    ->load($this
    ->getDerivativeId());
  $this->weatherDisplayPlaceStorage = $entityTypeManager
    ->getStorage('weather_display_place');
  $this->currentUser = $currentUser;
  $this->destination = WeatherDisplayInterface::SYSTEM_WIDE_TYPE;
}