UserLoginBarForm.php in UserLoginBar 8
File
lib/Drupal/userloginbar/Form/UserLoginBarForm.php
View source
<?php
namespace Drupal\userloginbar\Form;
use Drupal\system\SystemConfigFormBase;
class UserLoginBarForm extends SystemConfigFormBase {
public function getFormID() {
return 'userloginbar_settings';
}
public function buildForm(array $form, array &$form_state) {
$config = $this->configFactory
->get('userloginbar.settings');
$form['text'] = array(
'#type' => 'fieldset',
'#title' => t('Userloginbar Settings'),
);
$form['text']['disable_welcome_box'] = array(
'#type' => 'checkbox',
'#title' => t('Check this box, if you want to disable welcome box when the user logs in!'),
'#default_value' => $config
->get('disable_welcome_box'),
);
return parent::buildForm($form, $form_state);
}
public function submitForm(array &$form, array &$form_state) {
$this->configFactory
->get('userloginbar.settings')
->set('disable_welcome_box', $form_state['values']['disable_welcome_box'])
->save();
parent::submitForm($form, $form_state);
}
}
?>
<?php