You are here

protected function Chartjs::buildTitle in Charts 8.4

Same name and namespace in other branches
  1. 5.0.x modules/charts_chartjs/src/Plugin/chart/Library/Chartjs.php \Drupal\charts_chartjs\Plugin\chart\Library\Chartjs::buildTitle()

Builds title based on options.

Parameters

array $options: The options.

Return value

object The title objects.

File

modules/charts_chartjs/src/Plugin/chart/Library/Chartjs.php, line 147

Class

Chartjs
Define a concrete class for a Chart.

Namespace

Drupal\charts_chartjs\Plugin\chart\Library

Code

protected function buildTitle(array $options) {
  $title = new \stdClass();
  if (!empty($options['display']['title_position']) && !empty($options['display']['title'])) {
    $title->display = TRUE;
    $title->position = $options['display']['title_position'];
    $title->text = $options['display']['title'];
  }
  else {
    $title->display = FALSE;
  }
  return $title;
}