RulesBanActionBase.php in Rules 8.3
File
src/Plugin/RulesAction/RulesBanActionBase.php
View source
<?php
namespace Drupal\rules\Plugin\RulesAction;
use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\ban\BanIpManagerInterface;
use Drupal\rules\Core\RulesActionBase;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\DependencyInjection\ContainerInterface;
abstract class RulesBanActionBase extends RulesActionBase implements ContainerFactoryPluginInterface {
protected $banManager;
protected $requestStack;
protected $logger;
public function __construct(array $configuration, $plugin_id, $plugin_definition, BanIpManagerInterface $ban_manager, RequestStack $request_stack, LoggerChannelInterface $logger) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->banManager = $ban_manager;
$this->requestStack = $request_stack;
$this->logger = $logger;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('ban.ip_manager'), $container
->get('request_stack'), $container
->get('logger.factory')
->get('rules'));
}
}