You are here

public function ChartsPluginDisplayChart::buildOptionsForm in Charts 8

Same name and namespace in other branches
  1. 8.4 src/Plugin/views/display/ChartsPluginDisplayChart.php \Drupal\charts\Plugin\views\display\ChartsPluginDisplayChart::buildOptionsForm()
  2. 8.3 src/Plugin/views/display/ChartsPluginDisplayChart.php \Drupal\charts\Plugin\views\display\ChartsPluginDisplayChart::buildOptionsForm()
  3. 5.0.x src/Plugin/views/display/ChartsPluginDisplayChart.php \Drupal\charts\Plugin\views\display\ChartsPluginDisplayChart::buildOptionsForm()

Provide the default form for setting options.

Parameters

$form:

FormStateInterface $form_state:

Overrides Attachment::buildOptionsForm

File

src/Plugin/views/display/ChartsPluginDisplayChart.php, line 102
Contains the Chart display type (similar to Page, Block, Attachment, etc.)

Class

ChartsPluginDisplayChart
Display plugin to attach multiple chart configurations to the same chart.

Namespace

Drupal\charts\Plugin\views\display

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  switch ($form_state
    ->get('section')) {
    case 'displays':
      $form['#title'] .= t('Parent display');
      break;
    case 'inherit_yaxis':
      $form['#title'] .= t('Axis settings');
      $form['inherit_yaxis'] = array(
        '#title' => t('Y-Axis settings'),
        '#type' => 'radios',
        '#options' => array(
          1 => t('Inherit primary of parent display'),
          0 => t('Create a secondary axis'),
        ),
        '#default_value' => $this
          ->getOption('inherit_yaxis'),
        '#description' => 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.'),
      );
      break;
  }
}