From 566b7aa1bb78b16b7df0e4a5a175149609159655 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Mon, 4 Jun 2018 13:27:55 +0100 Subject: [PATCH] Issue #2904847 by mglaman, vaplas: Replace debug() statements in Views --- .../views/src/Plugin/views/field/FieldPluginBase.php | 8 +++++++- core/modules/views/src/Plugin/views/style/Opml.php | 4 ++-- core/modules/views/src/Plugin/views/style/Rss.php | 2 +- .../views/src/Plugin/views/style/StylePluginBase.php | 4 ++-- core/modules/views/tests/src/Kernel/ModuleTest.php | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php index d382681be05..cbae7e0b1d0 100644 --- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php +++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php @@ -185,7 +185,13 @@ abstract class FieldPluginBase extends HandlerBase implements FieldHandlerInterf } if (empty($table_alias)) { - debug(t('Handler @handler tried to add additional_field @identifier but @table could not be added!', ['@handler' => $this->definition['id'], '@identifier' => $identifier, '@table' => $info['table']])); + trigger_error(sprintf( + "Handler % tried to add additional_field %s but % could not be added!", + $this->definition['id'], + $identifier, + $info['table'] + ), E_USER_WARNING); + $this->aliases[$identifier] = 'broken'; continue; } diff --git a/core/modules/views/src/Plugin/views/style/Opml.php b/core/modules/views/src/Plugin/views/style/Opml.php index 016405e4c15..02b1e3d90e8 100644 --- a/core/modules/views/src/Plugin/views/style/Opml.php +++ b/core/modules/views/src/Plugin/views/style/Opml.php @@ -56,8 +56,8 @@ class Opml extends StylePluginBase { */ public function render() { if (empty($this->view->rowPlugin)) { - debug('Drupal\views\Plugin\views\style\Opml: Missing row plugin'); - return; + trigger_error('Drupal\views\Plugin\views\style\Opml: Missing row plugin', E_WARNING); + return []; } $rows = []; diff --git a/core/modules/views/src/Plugin/views/style/Rss.php b/core/modules/views/src/Plugin/views/style/Rss.php index 96d1deaeaf2..6693c4863e7 100644 --- a/core/modules/views/src/Plugin/views/style/Rss.php +++ b/core/modules/views/src/Plugin/views/style/Rss.php @@ -98,7 +98,7 @@ class Rss extends StylePluginBase { public function render() { if (empty($this->view->rowPlugin)) { - debug('Drupal\views\Plugin\views\style\Rss: Missing row plugin'); + trigger_error('Drupal\views\Plugin\views\style\Rss: Missing row plugin', E_WARNING); return []; } $rows = []; diff --git a/core/modules/views/src/Plugin/views/style/StylePluginBase.php b/core/modules/views/src/Plugin/views/style/StylePluginBase.php index 89e3dfbd876..740ef532311 100644 --- a/core/modules/views/src/Plugin/views/style/StylePluginBase.php +++ b/core/modules/views/src/Plugin/views/style/StylePluginBase.php @@ -457,8 +457,8 @@ abstract class StylePluginBase extends PluginBase { */ public function render() { if ($this->usesRowPlugin() && empty($this->view->rowPlugin)) { - debug('Drupal\views\Plugin\views\style\StylePluginBase: Missing row plugin'); - return; + trigger_error('Drupal\views\Plugin\views\style\StylePluginBase: Missing row plugin', E_WARNING); + return []; } // Group the rows according to the grouping instructions, if specified. diff --git a/core/modules/views/tests/src/Kernel/ModuleTest.php b/core/modules/views/tests/src/Kernel/ModuleTest.php index bef0675b981..f61c856200f 100644 --- a/core/modules/views/tests/src/Kernel/ModuleTest.php +++ b/core/modules/views/tests/src/Kernel/ModuleTest.php @@ -28,7 +28,7 @@ class ModuleTest extends ViewsKernelTestBase { public static $modules = ['field', 'user', 'block']; /** - * Stores the last triggered error, for example via debug(). + * Stores the last triggered error. * * @var string *