PISettings.php in International Phone 3.x
File
src/Form/PISettings.php
View source
<?php
namespace Drupal\phone_international\Form;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
class PISettings extends ConfigFormBase {
public function getFormId() {
return 'phone_international_admin_settings';
}
protected function getEditableConfigNames() {
return [
'phone_international.settings',
];
}
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('phone_international.settings');
$form['cdn'] = [
'#type' => 'checkbox',
'#default_value' => $config
->get('cdn'),
'#title' => $this
->t('Enable CDN Libraries'),
];
return parent::buildForm($form, $form_state);
}
public function submitForm(array &$form, FormStateInterface $form_state) {
$this
->config('phone_international.settings')
->set('cdn', $form_state
->getValue('cdn'))
->save();
parent::submitForm($form, $form_state);
}
}
Classes
Name |
Description |
PISettings |
Form with setting for phone international. |