You are here

public function ChartsBlock::blockSubmit in Charts 8.3

Same name and namespace in other branches
  1. 8.4 modules/charts_blocks/src/Plugin/Block/ChartsBlock.php \Drupal\charts_blocks\Plugin\Block\ChartsBlock::blockSubmit()
  2. 5.0.x modules/charts_blocks/src/Plugin/Block/ChartsBlock.php \Drupal\charts_blocks\Plugin\Block\ChartsBlock::blockSubmit()

Overrides BlockPluginTrait::blockSubmit

File

modules/charts_blocks/src/Plugin/Block/ChartsBlock.php, line 312

Class

ChartsBlock
Provides a 'ChartsBlock' block.

Namespace

Drupal\charts_blocks\Plugin\Block

Code

public function blockSubmit($form, FormStateInterface $form_state) {
  $this->configuration['library'] = $form_state
    ->getValue('library');
  $this->configuration['type'] = $form_state
    ->getValue('type');
  $this->configuration['series'] = $form_state
    ->getValue('series');
  $this->configuration['data'] = $form_state
    ->getValue('data');
  $this->configuration['color'] = $form_state
    ->getValue('color');
  $this->configuration['data_series'] = $form_state
    ->getValue('data_series');
  $this->configuration['series_label'] = $form_state
    ->getValue('series_label');
  $this->configuration['categories'] = $form_state
    ->getValue('categories');
  $this->configuration['grouping'] = $form_state
    ->getValue('grouping');
  $this->configuration['field_colors'] = $form_state
    ->getValue('field_colors');
  $this->configuration['title'] = $form_state
    ->getValue([
    'display',
    'title',
  ]);
  $this->configuration['title_position'] = $form_state
    ->getValue([
    'display',
    'title_position',
  ]);
  $this->configuration['data_labels'] = $form_state
    ->getValue([
    'display',
    'data_labels',
  ]);
  $this->configuration['data_markers'] = $form_state
    ->getValue([
    'display',
    'data_markers',
  ]);
  $this->configuration['legend'] = $form_state
    ->getValue('legend');
  $this->configuration['legend_position'] = $form_state
    ->getValue([
    'display',
    'legend_position',
  ]);
  $this->configuration['background'] = $form_state
    ->getValue([
    'display',
    'background',
  ]);
  $this->configuration['three_dimensional'] = $form_state
    ->getValue([
    'display',
    'three_dimensional',
  ]);
  $this->configuration['polar'] = $form_state
    ->getValue([
    'display',
    'polar',
  ]);
  $this->configuration['tooltips'] = $form_state
    ->getValue([
    'display',
    'tooltips',
  ]);
  $this->configuration['tooltips_use_html'] = $form_state
    ->getValue('tooltips_use_html');
  $this->configuration['width'] = $form_state
    ->getValue([
    'display',
    'dimensions',
    'width',
  ]);
  $this->configuration['height'] = $form_state
    ->getValue([
    'display',
    'dimensions',
    'height',
  ]);
  $this->configuration['width_units'] = $form_state
    ->getValue([
    'display',
    'dimensions',
    'width_units',
  ]);
  $this->configuration['height_units'] = $form_state
    ->getValue([
    'display',
    'dimensions',
    'height_units',
  ]);
  $this->configuration['xaxis_title'] = $form_state
    ->getValue([
    'xaxis',
    'xaxis_title',
  ]);
  $this->configuration['xaxis_labels_rotation'] = $form_state
    ->getValue([
    'xaxis',
    'xaxis_labels_rotation',
  ]);
  $this->configuration['yaxis_title'] = $form_state
    ->getValue([
    'yaxis',
    'title',
  ]);
  $this->configuration['yaxis_min'] = $form_state
    ->getValue([
    'yaxis',
    'yaxis_min',
  ]);
  $this->configuration['yaxis_max'] = $form_state
    ->getValue([
    'yaxis',
    'yaxis_max',
  ]);
  $this->configuration['yaxis_prefix'] = $form_state
    ->getValue([
    'yaxis',
    'yaxis_prefix',
  ]);
  $this->configuration['yaxis_suffix'] = $form_state
    ->getValue([
    'yaxis',
    'yaxis_suffix',
  ]);
  $this->configuration['yaxis_decimal_count'] = $form_state
    ->getValue([
    'yaxis',
    'yaxis_decimal_count',
  ]);
  $this->configuration['yaxis_labels_rotation'] = $form_state
    ->getValue([
    'yaxis',
    'yaxis_labels_rotation',
  ]);
  $this->configuration['inherit_yaxis'] = $form_state
    ->getValue([
    'yaxis',
    'inherit_yaxis',
  ]);
  $this->configuration['secondary_yaxis_title'] = $form_state
    ->getValue([
    'yaxis',
    'secondary_yaxis',
    'title',
  ]);
  $this->configuration['secondary_yaxis_min'] = $form_state
    ->getValue([
    'yaxis',
    'secondary_yaxis',
    'minmax',
    'min',
  ]);
  $this->configuration['secondary_yaxis_max'] = $form_state
    ->getValue([
    'yaxis',
    'secondary_yaxis',
    'minmax',
    'max',
  ]);
  $this->configuration['secondary_yaxis_prefix'] = $form_state
    ->getValue([
    'yaxis',
    'secondary_yaxis',
    'yaxis_prefix',
  ]);
  $this->configuration['secondary_yaxis_suffix'] = $form_state
    ->getValue([
    'yaxis',
    'secondary_yaxis',
    'yaxis_suffix',
  ]);
  $this->configuration['secondary_yaxis_decimal_count'] = $form_state
    ->getValue([
    'yaxis',
    'secondary_yaxis',
    'yaxis_decimal_count',
  ]);
  $this->configuration['secondary_yaxis_labels_rotation'] = $form_state
    ->getValue([
    'yaxis',
    'secondary_yaxis',
    'yaxis_labels_rotation',
  ]);

  // Set gauge specific settings.
  $gauge_fields = [
    'green_from',
    'green_to',
    'red_from',
    'red_to',
    'yellow_from',
    'yellow_to',
    'max',
    'min',
  ];
  foreach ($gauge_fields as $field) {
    $this->configuration[$field] = $form_state
      ->getValue([
      'display',
      'gauge',
      $field,
    ]);
  }
}