You are here

protected function KeyFormBase::createPluginFormState in Key 8

Creates a FormStateInterface object for a plugin.

Parameters

string $type: The plugin type ID.

\Drupal\Core\Form\FormStateInterface $form_state: The form state to copy values from.

Return value

\Drupal\Core\Form\FormStateInterface A clone of the form state object with values from the plugin.

3 calls to KeyFormBase::createPluginFormState()
KeyFormBase::form in src/Form/KeyFormBase.php
Gets the actual form array to be built.
KeyFormBase::submitForm in src/Form/KeyFormBase.php
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…
KeyFormBase::validateForm in src/Form/KeyFormBase.php
Form validation handler.

File

src/Form/KeyFormBase.php, line 494

Class

KeyFormBase
Base form for key add and edit forms.

Namespace

Drupal\key\Form

Code

protected function createPluginFormState($type, FormStateInterface $form_state) {

  // Clone the form state.
  $plugin_form_state = clone $form_state;

  // Clear the values, except for this plugin type's settings.
  $plugin_form_state
    ->setValues($form_state
    ->getValue($type . '_settings', []));
  return $plugin_form_state;
}