I’ll see may be tomorrow if i have time to reproduce it on a public instance.
I’ve made some tests, seems like this issue occurs when populating data for a datatables.
For a line chart, when i edit it, $data
is formatted like this :
Array
(
[source] => https://docs.google.com/spreadsheets/d/e/2PACX-1vQSolcWM_lQ0oHbNp_y-7PvG8WZtB2p3bh62lhXKqN9SYO9nlD3D9LRHUDF1ZPiKDbjVn_OX_yeCnkt/pub?gid=0&single=true&output=csv
[data] => Array
(
[0] => Array
(
[0] => 03/08/2019
[1] => 3000
)
[1] => Array
(
[0] => 04/08/2019
[1] => 3100
)
...
So here we must get data with $data['data']
.
If i make a datatables and try to edit it, this time $data
is formatted as below :
Array
(
[0] => Array
(
[0] => 2004/05/01
[1] => 165
[2] => 938
[3] => 522
[4] => 998
[5] => 450
)
[1] => Array
(
[0] => 2005/06/01
[1] => 135
[2] => 1120
[3] => 599
[4] => 1268
[5] => 288
)
...
For each chart, when i edit it, this method _renderEditorTable
is always called on Layout.php
with this foreach :
foreach ($data as $row) {
echo '<tr>';
echo '<th>' . __('Value', 'visualizer') . '</th>';
$index = 0;
foreach (array_values($row) as $value) {
if ($editable_data) {
echo '<td><input type="text" name="data' . $index++ . '[]" value="' . esc_attr($value) . '"></td>';
} else {
echo '<td>' . $value . '</td>';
}
}
echo '</tr>';
}
But $data
will not be the same, in the case of a line chart, array_values()
trigger an error because on the first iteration, $row
is the value of $data['source']
.
I hope i’m clear enough, is this normal thah _renderEditorTabl
is triggered when editing a line chart ?