You are here

public function RestExampleClientSettings::submitForm in Examples for Developers 3.x

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides ConfigFormBase::submitForm

File

modules/rest_example/src/Form/RestExampleClientSettings.php, line 58

Class

RestExampleClientSettings
Setup form for a Drupal REST client.

Namespace

Drupal\rest_example\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $form_values = $form_state
    ->getValues();
  $this
    ->config('rest_example.settings')
    ->set('server_url', $form_values['server_url'])
    ->set('server_username', $form_values['server_username'])
    ->set('server_password', $form_values['server_password'])
    ->save();
  parent::submitForm($form, $form_state);
}