class SalvattoreAdminSettingsForm in Salvattore (CSS driven Masonry) 8
Same name in this branch
- 8 src/SalvattoreAdminSettingsForm.php \Drupal\salvattore\SalvattoreAdminSettingsForm
- 8 src/Form/SalvattoreAdminSettingsForm.php \Drupal\salvattore\Form\SalvattoreAdminSettingsForm
Hierarchy
- class \Drupal\salvattore\SalvattoreAdminSettingsForm extends \Drupal\salvattore\ConfigFormBase
Expanded class hierarchy of SalvattoreAdminSettingsForm
File
- src/
SalvattoreAdminSettingsForm.php, line 4
Namespace
Drupal\salvattoreView source
class SalvattoreAdminSettingsForm extends ConfigFormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'salvattore_admin_settings_form';
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this
->config('salvattore.settings');
foreach (Element::children($form) as $variable) {
$config
->set($variable, $form_state
->getValue($form[$variable]['#parents']));
}
$config
->save();
if (method_exists($this, '_submitForm')) {
$this
->_submitForm($form, $form_state);
}
parent::submitForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return [
'salvattore.settings',
];
}
public function buildForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state) {
$form = [];
$form['salvattore_use_min_js'] = [
'#title' => t('Javascript file to use'),
'#description' => t('Please choose whether you want the minified or the full version of the JS file.'),
'#type' => 'radios',
'#options' => [
'1' => 'Minified',
'0' => 'Full (debug)',
],
'#default_value' => \Drupal::config('salvattore.settings')
->get('salvattore_use_min_js'),
];
$form['salvattore_load_default_css'] = [
'#title' => t('Load default CSS'),
'#description' => t('Salvattore is easily configurable via CSS and you should write your own in your theme.<br>If some reason you want to use the default then enable this setting.'),
'#type' => 'checkbox',
'#default_value' => \Drupal::config('salvattore.settings')
->get('salvattore_load_default_css'),
];
return parent::buildForm($form, $form_state);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SalvattoreAdminSettingsForm:: |
public | function | ||
SalvattoreAdminSettingsForm:: |
protected | function | ||
SalvattoreAdminSettingsForm:: |
public | function | ||
SalvattoreAdminSettingsForm:: |
public | function |