function BlockPluginTrait::submitConfigurationForm

Same name in other branches
  1. 9 core/lib/Drupal/Core/Block/BlockPluginTrait.php \Drupal\Core\Block\BlockPluginTrait::submitConfigurationForm()
  2. 8.9.x core/lib/Drupal/Core/Block/BlockPluginTrait.php \Drupal\Core\Block\BlockPluginTrait::submitConfigurationForm()
  3. 10 core/lib/Drupal/Core/Block/BlockPluginTrait.php \Drupal\Core\Block\BlockPluginTrait::submitConfigurationForm()

Most block plugins should not override this method. To add submission handling for a specific block type, override BlockBase::blockSubmit().

See also

\Drupal\Core\Block\BlockBase::blockSubmit()

File

core/lib/Drupal/Core/Block/BlockPluginTrait.php, line 228

Class

BlockPluginTrait
Provides the base implementation of a block plugin.

Namespace

Drupal\Core\Block

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
    // Process the block's submission handling if no errors occurred only.
    if (!$form_state->getErrors()) {
        $this->configuration['label'] = $form_state->getValue('label');
        $this->configuration['label_display'] = $form_state->getValue('label_display');
        $this->configuration['provider'] = $form_state->getValue('provider');
        $this->blockSubmit($form, $form_state);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.