Commit 4c11b7a9 authored by alexpott's avatar alexpott

Issue #2702001 by olafkarsten, Wim Leers: Inject config factory for BigPipe...

Issue #2702001 by olafkarsten, Wim Leers: Inject config factory for BigPipe (including in exception handlers)
parent 6dce6c2a
...@@ -11,7 +11,7 @@ services: ...@@ -11,7 +11,7 @@ services:
- { name: placeholder_strategy, priority: 0 } - { name: placeholder_strategy, priority: 0 }
big_pipe: big_pipe:
class: Drupal\big_pipe\Render\BigPipe class: Drupal\big_pipe\Render\BigPipe
arguments: ['@renderer', '@session', '@request_stack', '@http_kernel', '@event_dispatcher'] arguments: ['@renderer', '@session', '@request_stack', '@http_kernel', '@event_dispatcher', '@config.factory']
html_response.attachments_processor.big_pipe: html_response.attachments_processor.big_pipe:
public: false public: false
class: \Drupal\big_pipe\Render\BigPipeResponseAttachmentsProcessor class: \Drupal\big_pipe\Render\BigPipeResponseAttachmentsProcessor
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
use Drupal\Core\Ajax\ReplaceCommand; use Drupal\Core\Ajax\ReplaceCommand;
use Drupal\Core\Asset\AttachedAssets; use Drupal\Core\Asset\AttachedAssets;
use Drupal\Core\Asset\AttachedAssetsInterface; use Drupal\Core\Asset\AttachedAssetsInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Render\HtmlResponse; use Drupal\Core\Render\HtmlResponse;
use Drupal\Core\Render\RendererInterface; use Drupal\Core\Render\RendererInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
...@@ -73,6 +74,13 @@ class BigPipe implements BigPipeInterface { ...@@ -73,6 +74,13 @@ class BigPipe implements BigPipeInterface {
*/ */
protected $eventDispatcher; protected $eventDispatcher;
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/** /**
* Constructs a new BigPipe class. * Constructs a new BigPipe class.
* *
...@@ -86,13 +94,16 @@ class BigPipe implements BigPipeInterface { ...@@ -86,13 +94,16 @@ class BigPipe implements BigPipeInterface {
* The HTTP kernel. * The HTTP kernel.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* The event dispatcher. * The event dispatcher.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
*/ */
public function __construct(RendererInterface $renderer, SessionInterface $session, RequestStack $request_stack, HttpKernelInterface $http_kernel, EventDispatcherInterface $event_dispatcher) { public function __construct(RendererInterface $renderer, SessionInterface $session, RequestStack $request_stack, HttpKernelInterface $http_kernel, EventDispatcherInterface $event_dispatcher, ConfigFactoryInterface $config_factory) {
$this->renderer = $renderer; $this->renderer = $renderer;
$this->session = $session; $this->session = $session;
$this->requestStack = $request_stack; $this->requestStack = $request_stack;
$this->httpKernel = $http_kernel; $this->httpKernel = $http_kernel;
$this->eventDispatcher = $event_dispatcher; $this->eventDispatcher = $event_dispatcher;
$this->configFactory = $config_factory;
} }
/** /**
...@@ -243,7 +254,7 @@ protected function sendNoJsPlaceholders($html, $no_js_placeholders, AttachedAsse ...@@ -243,7 +254,7 @@ protected function sendNoJsPlaceholders($html, $no_js_placeholders, AttachedAsse
$elements = $this->renderPlaceholder($placeholder, $placeholder_plus_cumulative_settings); $elements = $this->renderPlaceholder($placeholder, $placeholder_plus_cumulative_settings);
} }
catch (\Exception $e) { catch (\Exception $e) {
if (\Drupal::config('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) { if ($this->configFactory->get('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
throw $e; throw $e;
} }
else { else {
...@@ -280,7 +291,7 @@ protected function sendNoJsPlaceholders($html, $no_js_placeholders, AttachedAsse ...@@ -280,7 +291,7 @@ protected function sendNoJsPlaceholders($html, $no_js_placeholders, AttachedAsse
$html_response = $this->filterEmbeddedResponse($fake_request, $html_response); $html_response = $this->filterEmbeddedResponse($fake_request, $html_response);
} }
catch (\Exception $e) { catch (\Exception $e) {
if (\Drupal::config('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) { if ($this->configFactory->get('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
throw $e; throw $e;
} }
else { else {
...@@ -355,7 +366,7 @@ protected function sendPlaceholders(array $placeholders, array $placeholder_orde ...@@ -355,7 +366,7 @@ protected function sendPlaceholders(array $placeholders, array $placeholder_orde
$elements = $this->renderPlaceholder($placeholder_id, $placeholder_render_array); $elements = $this->renderPlaceholder($placeholder_id, $placeholder_render_array);
} }
catch (\Exception $e) { catch (\Exception $e) {
if (\Drupal::config('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) { if ($this->configFactory->get('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
throw $e; throw $e;
} }
else { else {
...@@ -388,7 +399,7 @@ protected function sendPlaceholders(array $placeholders, array $placeholder_orde ...@@ -388,7 +399,7 @@ protected function sendPlaceholders(array $placeholders, array $placeholder_orde
$ajax_response = $this->filterEmbeddedResponse($fake_request, $ajax_response); $ajax_response = $this->filterEmbeddedResponse($fake_request, $ajax_response);
} }
catch (\Exception $e) { catch (\Exception $e) {
if (\Drupal::config('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) { if ($this->configFactory->get('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
throw $e; throw $e;
} }
else { else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment