You are here

public static function Overview::preRenderPlot in Flot 8

Add these new variables to drupalSettings.

Overrides Flot::preRenderPlot

File

flot_examples/src/Element/Overview.php, line 28

Class

Overview
Provides a flot render element.

Namespace

Drupal\flot_examples\Element

Code

public static function preRenderPlot($element) {
  $element = parent::preRenderPlot($element);

  // Create a collection of the data and options for the javascript files.
  $drupalsettings = $element['#attached']['drupalSettings'];
  $drupalsettings['flot'][$element['#id2']] = [
    'options' => $element['#options2'],
  ];
  $element['#attached']['drupalSettings'] = $drupalsettings;
  return $element;
}