ConfigFormBase.php in Zoom API 2.0.x
File
src/Form/ConfigFormBase.php
View source
<?php
namespace Drupal\zoomapi\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Form\ConfigFormBase as DrupalConfigFormBase;
abstract class ConfigFormBase extends DrupalConfigFormBase {
const CONFIG_NAME = 'zoomapi.settings';
public function getEditableConfigNames() {
return [
self::CONFIG_NAME,
];
}
protected function getConfig() {
return $this
->config(self::CONFIG_NAME);
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this
->getConfig();
$values = $form_state
->getValues();
$config
->set('base_uri', $values['base_uri']);
$config
->set('api_key', $values['api_key']);
$config
->set('api_secret', $values['api_secret']);
$config
->set('webhook_verification_token', $values['webhook_verification_token']);
$config
->save();
}
}