You are here

public function FieldPluginBase::submitOptionsForm in Views (for Drupal 7) 8.3

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

Overrides HandlerBase::submitOptionsForm

File

lib/Drupal/views/Plugin/views/field/FieldPluginBase.php, line 460
Definition of Drupal\views\Plugin\views\field\FieldPluginBase.

Class

FieldPluginBase
Base field handler that has no options and renders an unformatted field.

Namespace

Drupal\views\Plugin\views\field

Code

public function submitOptionsForm(&$form, &$form_state) {
  $options =& $form_state['values']['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;
  }
}