You are here

public function FieldPluginBase::submitOptionsForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::submitOptionsForm()

Performs some cleanup tasks on the options array before saving it.

Overrides PluginBase::submitOptionsForm

1 call to FieldPluginBase::submitOptionsForm()
NumericField::submitOptionsForm in core/modules/views/src/Plugin/views/field/NumericField.php
@inheritdoc
1 method overrides FieldPluginBase::submitOptionsForm()
NumericField::submitOptionsForm in core/modules/views/src/Plugin/views/field/NumericField.php
@inheritdoc

File

core/modules/views/src/Plugin/views/field/FieldPluginBase.php, line 483
Contains \Drupal\views\Plugin\views\field\FieldPluginBase.

Class

FieldPluginBase
Base class for views fields.

Namespace

Drupal\views\Plugin\views\field

Code

public function submitOptionsForm(&$form, FormStateInterface $form_state) {
  $options =& $form_state
    ->getValue('options');
  $types = array(
    'element_type',
    'element_label_type',
    'element_wrapper_type',
  );
  $classes = array_combine(array(
    'element_class',
    'element_label_class',
    'element_wrapper_class',
  ), $types);
  foreach ($types as $type) {
    if (!$options[$type . '_enable']) {
      $options[$type] = '';
    }
  }
  foreach ($classes as $class => $type) {
    if (!$options[$class . '_enable'] || !$options[$type . '_enable']) {
      $options[$class] = '';
    }
  }
  if (empty($options['custom_label'])) {
    $options['label'] = '';
    $options['element_label_colon'] = FALSE;
  }
}