public function Highcharts::buildConfigurationForm in Charts 8.4
Same name and namespace in other branches
- 5.0.x modules/charts_highcharts/src/Plugin/chart/Library/Highcharts.php \Drupal\charts_highcharts\Plugin\chart\Library\Highcharts::buildConfigurationForm()
Build configurations.
Parameters
array $form: The form element.
\Drupal\Core\Form\FormStateInterface $form_state: The form state.
Return value
array Return the from.
Overrides ChartBase::buildConfigurationForm
File
- modules/
charts_highcharts/ src/ Plugin/ chart/ Library/ Highcharts.php, line 54
Class
- Highcharts
- Defines a concrete class for a Highcharts.
Namespace
Drupal\charts_highcharts\Plugin\chart\LibraryCode
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$form['placeholder'] = [
'#title' => $this
->t('Placeholder'),
'#type' => 'fieldset',
'#description' => $this
->t('This is a placeholder for Highcharts-specific library options. If you would like to help build this out, please work from <a href="@issue_link">this issue</a>.', [
'@issue_link' => Url::fromUri('https://www.drupal.org/project/charts/issues/3046981')
->toString(),
]),
];
$legend_configuration = $this->configuration['legend'] ?? [];
$form['legend'] = [
'#title' => $this
->t('Legend Settings'),
'#type' => 'fieldset',
];
$form['legend']['layout'] = [
'#title' => $this
->t('Legend layout'),
'#type' => 'select',
'#options' => [
'vertical' => $this
->t('Vertical'),
'horizontal' => $this
->t('Horizontal'),
],
'#default_value' => $legend_configuration['layout'] ?? NULL,
];
$form['legend']['background_color'] = [
'#title' => $this
->t('Legend background color'),
'#type' => 'textfield',
'#size' => 10,
'#maxlength' => 7,
'#attributes' => [
'placeholder' => $this
->t('transparent'),
],
'#description' => $this
->t('Leave blank for a transparent background.'),
'#default_value' => $legend_configuration['background_color'] ?? '',
];
$form['legend']['border_width'] = [
'#title' => $this
->t('Legend border width'),
'#type' => 'select',
'#options' => [
0 => $this
->t('None'),
1 => 1,
2 => 2,
3 => 3,
4 => 4,
5 => 5,
],
'#default_value' => $legend_configuration['border_width'] ?? 0,
];
$form['legend']['shadow'] = [
'#title' => $this
->t('Enable legend shadow'),
'#type' => 'checkbox',
'#default_value' => !empty($legend_configuration['shadow']),
];
$form['legend']['item_style'] = [
'#title' => $this
->t('Item Style'),
'#type' => 'fieldset',
];
$form['legend']['item_style']['color'] = [
'#title' => $this
->t('Item style color'),
'#type' => 'textfield',
'#size' => 10,
'#maxlength' => 7,
'#attributes' => [
'placeholder' => '#333333',
],
'#description' => $this
->t('Leave blank for a dark gray font.'),
'#default_value' => $legend_configuration['item_style']['color'] ?? '',
];
$form['legend']['item_style']['overflow'] = [
'#title' => $this
->t('Text overflow'),
'#type' => 'select',
'#options' => [
'' => $this
->t('No'),
'ellipsis' => $this
->t('Ellipsis'),
],
'#default_value' => $legend_configuration['item_style']['overflow'] ?? '',
];
return $form;
}