Overview.php in Flot 8
File
flot_examples/src/Element/Overview.php
View source
<?php
namespace Drupal\flot_examples\Element;
use Drupal\flot\Element\Flot;
class Overview extends Flot {
public function getInfo() {
$output = parent::getInfo();
$output['#options2'] = NULL;
$output['#id2'] = 'overview';
return $output;
}
public static function preRenderPlot($element) {
$element = parent::preRenderPlot($element);
$drupalsettings = $element['#attached']['drupalSettings'];
$drupalsettings['flot'][$element['#id2']] = [
'options' => $element['#options2'],
];
$element['#attached']['drupalSettings'] = $drupalsettings;
return $element;
}
}