From 70e9ec0fcd01f72d79eea3ebff9be45d908bb99a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Sat, 18 Nov 2017 23:40:56 -0200 Subject: [PATCH] Use template for _buildValueDisplay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- libraries/classes/Display/Results.php | 18 ++++++++++-------- templates/display/results/value_display.twig | 3 +++ test/classes/Display/ResultsTest.php | 11 +++++++---- 3 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 templates/display/results/value_display.twig diff --git a/libraries/classes/Display/Results.php b/libraries/classes/Display/Results.php index 854505ea06..88be9626b9 100644 --- a/libraries/classes/Display/Results.php +++ b/libraries/classes/Display/Results.php @@ -2339,9 +2339,9 @@ class Results /** * Prepares the display for a value * - * @param string $class class of table cell - * @param bool $condition_field whether to add CSS class condition - * @param string $value value to display + * @param string $class class of table cell + * @param bool $conditionField whether to add CSS class condition + * @param string $value value to display * * @return string the td * @@ -2350,12 +2350,14 @@ class Results * @see _getDataCellForGeometryColumns(), * _getDataCellForNonNumericColumns() */ - private function _buildValueDisplay($class, $condition_field, $value) + private function _buildValueDisplay($class, $conditionField, $value) { - return '' . $value . ''; - } // end of the '_buildValueDisplay()' function - + return Template::get('display/results/value_display')->render([ + 'class' => $class, + 'condition_field' => $conditionField, + 'value' => $value, + ]); + } /** * Prepares the display for a null value diff --git a/templates/display/results/value_display.twig b/templates/display/results/value_display.twig new file mode 100644 index 0000000000..35640b91ca --- /dev/null +++ b/templates/display/results/value_display.twig @@ -0,0 +1,3 @@ + + {{ value|raw }} + diff --git a/test/classes/Display/ResultsTest.php b/test/classes/Display/ResultsTest.php index 28b98abe03..87cde0cf56 100644 --- a/test/classes/Display/ResultsTest.php +++ b/test/classes/Display/ResultsTest.php @@ -1491,11 +1491,13 @@ class ResultsTest extends PmaTestCase array(), 0, 'binary', - '' . PHP_EOL + . ' [BLOB - 4 B]' + . 'class="disableAjax">[BLOB - 4 B]' . PHP_EOL + . '' . PHP_EOL ), array( 'noblob', @@ -1512,8 +1514,9 @@ class ResultsTest extends PmaTestCase array(), 0, 'binary', - '' - . '1001' + '' . PHP_EOL + . ' 1001' . PHP_EOL + . '' . PHP_EOL ), array( 'noblob',