currentUser = $current_user; $this->tempStore = $temp_store_factory->get('comment_multiple_delete_confirm'); parent::__construct($configuration, $plugin_id, $plugin_definition); } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $configuration, $plugin_id, $plugin_definition, $container->get('user.private_tempstore'), $container->get('current_user') ); } /** * {@inheritdoc} */ public function executeMultiple(array $entities) { $info = []; /** @var \Drupal\comment\CommentInterface $comment */ foreach ($entities as $comment) { $langcode = $comment->language()->getId(); $info[$comment->id()][$langcode] = $langcode; } $this->tempStore->set($this->currentUser->id(), $info); } /** * {@inheritdoc} */ public function execute($entity = NULL) { $this->executeMultiple([$entity]); } /** * {@inheritdoc} */ public function access($comment, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\comment\CommentInterface $comment */ return $comment->access('delete', $account, $return_as_object); } }