Issue #2507459 by Wim Leers: CachePluginBase and subclasses no longer need Renderer/RenderCache services injected
parent
c9769f3b1b
commit
06c77e7950
|
@ -8,8 +8,6 @@
|
|||
namespace Drupal\views\Plugin\views\cache;
|
||||
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Render\RenderCacheInterface;
|
||||
use Drupal\Core\Render\RendererInterface;
|
||||
use Drupal\views\Plugin\views\PluginBase;
|
||||
use Drupal\Core\Database\Query\Select;
|
||||
use Drupal\views\ResultRow;
|
||||
|
@ -58,54 +56,6 @@ abstract class CachePluginBase extends PluginBase {
|
|||
*/
|
||||
protected $resultsKey;
|
||||
|
||||
/**
|
||||
* The HTML renderer.
|
||||
*
|
||||
* @var \Drupal\Core\Render\RendererInterface
|
||||
*/
|
||||
protected $renderer;
|
||||
|
||||
/**
|
||||
* The render cache service.
|
||||
*
|
||||
* @var \Drupal\Core\Render\RenderCacheInterface
|
||||
*/
|
||||
protected $renderCache;
|
||||
|
||||
/**
|
||||
* Constructs a CachePluginBase object.
|
||||
*
|
||||
* @param array $configuration
|
||||
* A configuration array containing information about the plugin instance.
|
||||
* @param string $plugin_id
|
||||
* The plugin_id for the plugin instance.
|
||||
* @param mixed $plugin_definition
|
||||
* The plugin implementation definition.
|
||||
* @param \Drupal\Core\Render\RendererInterface $renderer
|
||||
* The HTML renderer.
|
||||
* @param \Drupal\Core\Render\RenderCacheInterface $render_cache
|
||||
* The render cache service.
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, RendererInterface $renderer, RenderCacheInterface $render_cache) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
||||
|
||||
$this->renderer = $renderer;
|
||||
$this->renderCache = $render_cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
|
||||
return new static(
|
||||
$configuration,
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
$container->get('renderer'),
|
||||
$container->get('render_cache')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the resultsKey property.
|
||||
*
|
||||
|
|
|
@ -9,8 +9,6 @@ namespace Drupal\views\Plugin\views\cache;
|
|||
|
||||
use Drupal\Core\Datetime\DateFormatter;
|
||||
use Drupal\Core\Cache\Cache;
|
||||
use Drupal\Core\Render\RenderCacheInterface;
|
||||
use Drupal\Core\Render\RendererInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
@ -56,20 +54,16 @@ class Time extends CachePluginBase {
|
|||
* The plugin_id for the plugin instance.
|
||||
* @param mixed $plugin_definition
|
||||
* The plugin implementation definition.
|
||||
* @param \Drupal\Core\Render\RendererInterface $renderer
|
||||
* The HTML renderer.
|
||||
* @param \Drupal\Core\Datetime\DateFormatter $date_formatter
|
||||
* The date formatter service.
|
||||
* @param \Drupal\Core\Render\RenderCacheInterface $render_cache
|
||||
* The render cache service.
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* The current request.
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, RendererInterface $renderer, RenderCacheInterface $render_cache, DateFormatter $date_formatter, Request $request) {
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, DateFormatter $date_formatter, Request $request) {
|
||||
$this->dateFormatter = $date_formatter;
|
||||
$this->request = $request;
|
||||
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition, $renderer, $render_cache);
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,8 +74,6 @@ class Time extends CachePluginBase {
|
|||
$configuration,
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
$container->get('renderer'),
|
||||
$container->get('render_cache'),
|
||||
$container->get('date.formatter'),
|
||||
$container->get('request_stack')->getCurrentRequest()
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue