You are here

public function ExtraFieldBlockPlugin::submitConfigurationForm in Entity Extra Field 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/ExtraFieldType/ExtraFieldBlockPlugin.php \Drupal\entity_extra_field\Plugin\ExtraFieldType\ExtraFieldBlockPlugin::submitConfigurationForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides ExtraFieldTypePluginBase::submitConfigurationForm

File

src/Plugin/ExtraFieldType/ExtraFieldBlockPlugin.php, line 224

Class

ExtraFieldBlockPlugin
Define extra field block type.

Namespace

Drupal\entity_extra_field\Plugin\ExtraFieldType

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) : void {
  parent::submitConfigurationForm($form, $form_state);
  $block_instance = $this
    ->getBlockTypeInstance();
  if ($block_instance instanceof PluginFormInterface) {
    $subform = [
      '#parents' => array_merge($form['#parents'], [
        'block_config',
      ]),
    ];
    $block_instance
      ->submitConfigurationForm($subform, SubformState::createForSubform($subform, $form, $form_state));
    $form_state
      ->setValue([
      'block_config',
    ], $block_instance
      ->getConfiguration());
  }
}