When viewing a chart (I used Highcharts) the follow notices were logged:

Notice: Undefined index: data_labels in Drupal\charts_highcharts\Charts\HighchartsChartsRender->chartsRenderCharts() (line 161 of web/modules/contrib/charts/modules/charts_highcharts/src/Charts/HighchartsChartsRender.php).
Notice: Undefined index: tooltips in Drupal\charts_highcharts\Charts\HighchartsChartsRender->chartsRenderCharts() (line 166 of web/modules/contrib/charts/modules/charts_highcharts/src/Charts/HighchartsChartsRender.php).

Checks should be added to ensure that the setting are available before using them.

CommentFileSizeAuthor
#2 2944101-logged_notices-2.patch1.38 KBJohn Cook
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

John Cook created an issue. See original summary.

John Cook’s picture

Status: Active » Needs review
FileSize
1.38 KB

I created a patch so that the setting are checked before use.

$plotOptionsSeriesDataLabels->setEnabled($options['data_labels']); was in all the execution branches so I moved it out to after the check for grouping, and checked for it's presence there.

I also fixed a small coding standards bug.

  • andileco committed eb6506d on 8.x-3.x
    Issue #2944101 by John Cook: Notices logged when viewing charts
    
andileco’s picture

Status: Needs review » Fixed
andileco’s picture

Status: Fixed » Closed (fixed)