SocialTourSettings.php in Open Social 10.0.x
Same filename and directory in other branches
- 8.9 modules/custom/social_tour/src/Form/SocialTourSettings.php
- 8 modules/custom/social_tour/src/Form/SocialTourSettings.php
- 8.2 modules/custom/social_tour/src/Form/SocialTourSettings.php
- 8.3 modules/custom/social_tour/src/Form/SocialTourSettings.php
- 8.4 modules/custom/social_tour/src/Form/SocialTourSettings.php
- 8.5 modules/custom/social_tour/src/Form/SocialTourSettings.php
- 8.6 modules/custom/social_tour/src/Form/SocialTourSettings.php
- 8.7 modules/custom/social_tour/src/Form/SocialTourSettings.php
- 8.8 modules/custom/social_tour/src/Form/SocialTourSettings.php
- 10.3.x modules/custom/social_tour/src/Form/SocialTourSettings.php
- 10.1.x modules/custom/social_tour/src/Form/SocialTourSettings.php
- 10.2.x modules/custom/social_tour/src/Form/SocialTourSettings.php
Namespace
Drupal\social_tour\FormFile
modules/custom/social_tour/src/Form/SocialTourSettings.phpView source
<?php
namespace Drupal\social_tour\Form;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Class SocialTourSettings.
*
* @package Drupal\social_tour\Form
*/
class SocialTourSettings extends ConfigFormBase {
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return [
'social_tour.settings',
];
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'social_tour_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('social_tour.settings');
$form['social_tour_enabled'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable the social tour'),
'#description' => $this
->t('Set whether the tour is enabled or not.'),
'#default_value' => $config
->get('social_tour_enabled'),
];
return parent::buildForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$this
->config('social_tour.settings')
->set('social_tour_enabled', $form_state
->getValue('social_tour_enabled'))
->save();
}
}
Classes
Name | Description |
---|---|
SocialTourSettings | Class SocialTourSettings. |