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

Breadcrumb

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

function Sql::submitOptionsForm

Special submit handling.

Overrides QueryPluginBase::submitOptionsForm

File

core/modules/views/src/Plugin/views/query/Sql.php, line 357

Class

Sql
Views query plugin for an SQL query.

Namespace

Drupal\views\Plugin\views\query

Code

public function submitOptionsForm(&$form, FormStateInterface $form_state) {
    $element = [
        '#parents' => [
            'query',
            'options',
            'query_tags',
        ],
    ];
    $value = NestedArray::getValue($form_state->getValues(), $element['#parents']);
    // When toggling a display to override defaults or vice-versa the submit
    // handler gets invoked twice, and we don't want to bash the values from the
    // original call.
    if (is_array($value)) {
        return;
    }
    $value = array_filter(array_map('trim', explode(',', $value)));
    $form_state->setValueForElement($element, $value);
}

API Navigation

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