ChartsConfigForm.php in Charts 8.3
File
modules/charts_google/src/Form/ChartsConfigForm.php
View source
<?php
namespace Drupal\charts_google\Form;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
class ChartsConfigForm extends ConfigFormBase {
public function getFormId() {
return 'charts_google_settings';
}
protected function getEditableConfigNames() {
return [
'charts_google.settings',
];
}
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('charts_google.settings');
$form['placeholder'] = [
'#title' => $this
->t('Placeholder'),
'#type' => 'fieldset',
'#description' => $this
->t('This is a placeholder for Google-specific library options. If you would like to help build this out, please work from <a href="@issue_link">this issue</a>.', [
'@issue_link' => Url::fromUri('https://www.drupal.org/project/charts/issues/3046980')
->toString(),
]),
];
return parent::buildForm($form, $form_state);
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$this
->config('charts_google.settings')
->set('placeholder', $form_state
->getValue('placeholder'))
->save();
parent::submitForm($form, $form_state);
}
}