You are here

protected function PanelsIPEBlockPluginForm::submitBlock in Panels 8.3

Same name and namespace in other branches
  1. 8.4 panels_ipe/src/Form/PanelsIPEBlockPluginForm.php \Drupal\panels_ipe\Form\PanelsIPEBlockPluginForm::submitBlock()

Executes the block plugin's submit handlers.

Parameters

\Drupal\Core\Block\BlockPluginInterface $block_instance: The block instance.

array $form: The full form.

\Drupal\Core\Form\FormStateInterface $form_state: The full form state.

2 calls to PanelsIPEBlockPluginForm::submitBlock()
PanelsIPEBlockPluginForm::submitForm in panels_ipe/src/Form/PanelsIPEBlockPluginForm.php
Form submission handler.
PanelsIPEBlockPluginForm::submitPreview in panels_ipe/src/Form/PanelsIPEBlockPluginForm.php
Previews our current Block configuration.

File

panels_ipe/src/Form/PanelsIPEBlockPluginForm.php, line 248

Class

PanelsIPEBlockPluginForm
Provides a form for adding a block plugin temporarily using AJAX.

Namespace

Drupal\panels_ipe\Form

Code

protected function submitBlock(BlockPluginInterface $block_instance, array $form, FormStateInterface $form_state) {
  $block_form_state = (new FormState())
    ->setValues($form_state
    ->getValue('settings'));
  $block_instance
    ->submitConfigurationForm($form['flipper']['front']['settings'], $block_form_state);
  if ($block_instance instanceof ContextAwarePluginInterface) {
    $block_instance
      ->setContextMapping($block_form_state
      ->getValue('context_mapping', []));
  }

  // Update the original form values.
  $form_state
    ->setValue('settings', $block_form_state
    ->getValues());
}