You are here

public function WebformAnalysisChart::buildComponentData in Webform Analysis 8

Build Component Data.

Parameters

\Drupal\webform_analysis\WebformAnalysisInterface $analysis: Analysis.

string $component: Component.

string $id: Id.

Return value

array Renderable.

Overrides WebformAnalysisChartInterface::buildComponentData

1 call to WebformAnalysisChart::buildComponentData()
WebformAnalysisChart::build in src/WebformAnalysisChart.php
Build.

File

src/WebformAnalysisChart.php, line 99

Class

WebformAnalysisChart
Webform Analysis Chart.

Namespace

Drupal\webform_analysis

Code

public function buildComponentData(WebformAnalysisInterface $analysis, $component = '', $id = '') {
  $class_css = 'webform-chart--' . $component;
  return [
    '#theme' => 'webform_analysis_component',
    '#name' => $component,
    '#title' => $analysis
      ->getComponentTitle($component),
    '#data' => [
      '#theme' => 'table',
      '#prefix' => '<div id="' . $id . '" class="' . $class_css . '">',
      '#suffix' => '</div>',
    ],
  ];
}