Use template for _buildNullDisplay method
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
parent
70e9ec0fcd
commit
bdb35e5769
@ -2362,10 +2362,10 @@ class Results
|
||||
/**
|
||||
* Prepares the display for a null value
|
||||
*
|
||||
* @param string $class class of table cell
|
||||
* @param bool $condition_field whether to add CSS class condition
|
||||
* @param object $meta the meta-information about this field
|
||||
* @param string $align cell alignment
|
||||
* @param string $class class of table cell
|
||||
* @param bool $conditionField whether to add CSS class condition
|
||||
* @param object $meta the meta-information about this field
|
||||
* @param string $align cell alignment
|
||||
*
|
||||
* @return string the td
|
||||
*
|
||||
@ -2375,18 +2375,16 @@ class Results
|
||||
* _getDataCellForGeometryColumns(),
|
||||
* _getDataCellForNonNumericColumns()
|
||||
*/
|
||||
private function _buildNullDisplay($class, $condition_field, $meta, $align = '')
|
||||
private function _buildNullDisplay($class, $conditionField, $meta, $align = '')
|
||||
{
|
||||
// the null class is needed for grid editing
|
||||
$decimals = isset($meta->decimals) ? $meta->decimals : '-1';
|
||||
return '<td ' . $align . ' data-decimals="' . $decimals
|
||||
. '" data-type="' . $meta->type . '" class="'
|
||||
. $this->_addClass(
|
||||
$class, $condition_field, $meta, ''
|
||||
)
|
||||
. ' null"><i>NULL</i></td>';
|
||||
} // end of the '_buildNullDisplay()' function
|
||||
$classes = $this->_addClass($class, $conditionField, $meta, '');
|
||||
|
||||
return Template::get('display/results/null_display')->render([
|
||||
'align' => $align,
|
||||
'meta' => $meta,
|
||||
'classes' => $classes,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the display for an empty value
|
||||
|
||||
7
templates/display/results/null_display.twig
Normal file
7
templates/display/results/null_display.twig
Normal file
@ -0,0 +1,7 @@
|
||||
<td {{ align }}
|
||||
data-decimals="{{ meta.decimals is defined ? meta.decimals : '-1' }}"
|
||||
data-type="{{ meta.type }}"
|
||||
{# The null class is needed for grid editing #}
|
||||
class="{{ classes }} null">
|
||||
<em>NULL</em>
|
||||
</td>
|
||||
@ -1533,8 +1533,12 @@ class ResultsTest extends PmaTestCase
|
||||
array(),
|
||||
0,
|
||||
0,
|
||||
'<td data-decimals="0" data-type="string" '
|
||||
. 'class="grid_edit null"><i>NULL</i></td>'
|
||||
'<td ' . PHP_EOL
|
||||
. ' data-decimals="0"' . PHP_EOL
|
||||
. ' data-type="string"' . PHP_EOL
|
||||
. ' class="grid_edit null">' . PHP_EOL
|
||||
. ' <em>NULL</em>' . PHP_EOL
|
||||
. '</td>' . PHP_EOL
|
||||
),
|
||||
array(
|
||||
'all',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user