Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. FieldPluginBase.php

function FieldPluginBase::submitOptionsForm

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

Overrides PluginBase::submitOptionsForm

2 calls to FieldPluginBase::submitOptionsForm()
NumericField::submitOptionsForm in core/modules/views/src/Plugin/views/field/NumericField.php
Performs some cleanup tasks on the options array before saving it.
NumericField::submitOptionsForm in core/modules/views/src/Plugin/views/field/NumericField.php
Performs some cleanup tasks on the options array before saving it.
1 method overrides FieldPluginBase::submitOptionsForm()
NumericField::submitOptionsForm in core/modules/views/src/Plugin/views/field/NumericField.php
Performs some cleanup tasks on the options array before saving it.

File

core/modules/views/src/Plugin/views/field/FieldPluginBase.php, line 543

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 = [
        'element_type',
        'element_label_type',
        'element_wrapper_type',
    ];
    $classes = array_combine([
        '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;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal