ConfigFormBase.php in Zoom API 8
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();
foreach ($values as $key => $value) {
$config
->set($key, $value);
}
$config
->save();
}
}