You are here

private function Chart::getLibrary in Charts 8.4

Same name and namespace in other branches
  1. 5.0.x src/Element/Chart.php \Drupal\charts\Element\Chart::getLibrary()

Get the library.

Parameters

string $library: The library.

Return value

string The library.

1 call to Chart::getLibrary()
Chart::preRender in src/Element/Chart.php
Main #pre_render callback to expand a chart element.

File

src/Element/Chart.php, line 282

Class

Chart
Provides a chart render element.

Namespace

Drupal\charts\Element

Code

private function getLibrary($library) {
  $definitions = $this->chartsManager
    ->getDefinitions();
  if (!$library || $library === 'site_default') {
    $library = $this->chartSettings['library'] ?? key($definitions);
  }
  elseif (!isset($definitions[$library])) {
    $library = key($definitions);
  }
  return $library;
}