You are here

public function ExposedChartType::buildOptionsForm in Charts 5.0.x

Same name and namespace in other branches
  1. 8.4 src/Plugin/views/field/ExposedChartType.php \Drupal\charts\Plugin\views\field\ExposedChartType::buildOptionsForm()
  2. 8.3 src/Plugin/views/field/ExposedChartType.php \Drupal\charts\Plugin\views\field\ExposedChartType::buildOptionsForm()

Default options form that provides the label widget that all fields should have.

Overrides FieldPluginBase::buildOptionsForm

File

src/Plugin/views/field/ExposedChartType.php, line 81

Class

ExposedChartType
Provides a Views handler that exposes a Chart Type field.

Namespace

Drupal\charts\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['chart_types'] = [
    '#type' => 'checkboxes',
    '#title' => $this
      ->t('Chart Type Options'),
    '#description' => $this
      ->t('Pick the chart type options to be exposed. You may need to disable your Views cache.'),
    '#options' => BaseSettings::getChartTypes(),
    '#default_value' => $this->options['chart_types'],
  ];
  $form['exposed_select_type'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Exposed Selection Type'),
    '#description' => $this
      ->t('Choose your options widget.'),
    '#options' => [
      'radios' => $this
        ->t('Radios'),
      'select' => $this
        ->t('Single select'),
    ],
    '#default_value' => $this->options['exposed_select_type'],
  ];
}