public function ChartsPluginDisplayChart::buildOptionsForm in Charts 5.0.x
Same name and namespace in other branches
- 8.4 src/Plugin/views/display/ChartsPluginDisplayChart.php \Drupal\charts\Plugin\views\display\ChartsPluginDisplayChart::buildOptionsForm()
- 8 src/Plugin/views/display/ChartsPluginDisplayChart.php \Drupal\charts\Plugin\views\display\ChartsPluginDisplayChart::buildOptionsForm()
- 8.3 src/Plugin/views/display/ChartsPluginDisplayChart.php \Drupal\charts\Plugin\views\display\ChartsPluginDisplayChart::buildOptionsForm()
Provide the default form for setting options.
Overrides Attachment::buildOptionsForm
File
- src/
Plugin/ views/ display/ ChartsPluginDisplayChart.php, line 89
Class
- ChartsPluginDisplayChart
- Display plugin to attach multiple chart configurations to the same chart.
Namespace
Drupal\charts\Plugin\views\displayCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
switch ($form_state
->get('section')) {
case 'displays':
$form['#title'] .= $this
->t('Parent display');
break;
case 'inherit_yaxis':
$form['#title'] .= $this
->t('Axis settings');
$form['inherit_yaxis'] = [
'#title' => $this
->t('Y-Axis settings'),
'#type' => 'radios',
'#options' => [
1 => $this
->t('Inherit primary of parent display'),
0 => $this
->t('Create a secondary axis'),
],
'#default_value' => $this
->getOption('inherit_yaxis'),
'#description' => $this
->t('In most charts, the x- and y-axis from the parent display are both shared with each attached child chart. However, if this chart is going to use a different unit of measurement, a secondary axis may be added on the opposite side of the normal y-axis. Only create a secondary y-axis on the first chart attachment. You can rearrange displays if needed.'),
];
break;
}
}