Problem/Motivation
When having empty categories in a bar chart, multiple warnings are written to the Drupal log.
Warning: current() expects parameter 1 to be array, string given in Drupal\charts\Plugin\views\style\ChartsPluginStyleChart->processNumberValueFromField() (line 500 of /....../modules/contrib/charts/src/Plugin/views/style/ChartsPluginStyleChart.php)
Steps to reproduce
Create a stacked column chart.
Let it render also empty data series.
Check Drupal log - for each empty row you will get at least 3 log entries.
Proposed resolution
The function processNumberValueFromField uses the getField method to get the rendered field value and then supplies it to the current() php function, which triggers the warning if the value returned by getField() is not an array.
Need a simple check for this to avoid the warning and the log spamming.
Remaining tasks
Provide a patch.
User interface changes
None
API changes
None
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | Empty_rows_result_in_log_warning-3216611-2.patch | 801 bytes | jordik |
Comments
Comment #2
jordik commentedComment #3
jordik commentedComment #5
andileco commentedThanks for the patch!