DeleteFeed.php in Feeds 8.3
File
src/Plugin/Action/DeleteFeed.php
View source
<?php
namespace Drupal\feeds\Plugin\Action;
use Drupal\Core\Action\ActionBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\TempStore\PrivateTempStore;
use Symfony\Component\DependencyInjection\ContainerInterface;
class DeleteFeed extends ActionBase implements ContainerFactoryPluginInterface {
protected $tempStore;
protected $user;
public function __construct(array $configuration, $plugin_id, array $plugin_definition, PrivateTempStore $temp_store, AccountInterface $user) {
$this->tempStore = $temp_store;
$this->user = $user;
parent::__construct($configuration, $plugin_id, $plugin_definition);
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
$temp_store = $container
->get('tempstore.private')
->get('feeds_feed_multiple_delete_confirm');
return new static($configuration, $plugin_id, $plugin_definition, $temp_store, $container
->get('current_user'));
}
public function executeMultiple(array $entities) {
$this->tempStore
->set($this->user
->id(), $entities);
}
public function execute($object = NULL) {
$this
->executeMultiple([
$object,
]);
}
public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
return TRUE;
}
}