class EventInviteSettingsForm in Open Social 10.2.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_event/modules/social_event_invite/src/Form/EventInviteSettingsForm.php \Drupal\social_event_invite\Form\EventInviteSettingsForm
- 10.3.x modules/social_features/social_event/modules/social_event_invite/src/Form/EventInviteSettingsForm.php \Drupal\social_event_invite\Form\EventInviteSettingsForm
- 10.0.x modules/social_features/social_event/modules/social_event_invite/src/Form/EventInviteSettingsForm.php \Drupal\social_event_invite\Form\EventInviteSettingsForm
- 10.1.x modules/social_features/social_event/modules/social_event_invite/src/Form/EventInviteSettingsForm.php \Drupal\social_event_invite\Form\EventInviteSettingsForm
Class EnrollInviteForm.
Hierarchy
- class \Drupal\Core\Form\FormBase implements ContainerInjectionInterface, FormInterface uses DependencySerializationTrait, LoggerChannelTrait, MessengerTrait, RedirectDestinationTrait, StringTranslationTrait
- class \Drupal\Core\Form\ConfigFormBase uses ConfigFormBaseTrait
- class \Drupal\social_event_invite\Form\EventInviteSettingsForm
- class \Drupal\Core\Form\ConfigFormBase uses ConfigFormBaseTrait
Expanded class hierarchy of EventInviteSettingsForm
1 string reference to 'EventInviteSettingsForm'
- social_event_invite.routing.yml in modules/
social_features/ social_event/ modules/ social_event_invite/ social_event_invite.routing.yml - modules/social_features/social_event/modules/social_event_invite/social_event_invite.routing.yml
File
- modules/
social_features/ social_event/ modules/ social_event_invite/ src/ Form/ EventInviteSettingsForm.php, line 12
Namespace
Drupal\social_event_invite\FormView source
class EventInviteSettingsForm extends ConfigFormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'enroll_invite_email_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$social_event_config = $this->configFactory
->getEditable('social_event_invite.settings');
// Add an introduction text to explain what can be done here.
$form['introduction']['warning'] = [
'#type' => 'html_tag',
'#tag' => 'p',
'#value' => $this
->t('Be aware that when disabling invites altogether or for a specific group type, the outstanding invites in question <em>are cancelled</em>. Invitees will no longer be able to use their invite link.'),
];
$form['invite_enroll'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable invite enrollment to events'),
'#description' => $this
->t('Enabling this feature provides the possibility to let event managers to invite people to their events.'),
'#default_value' => $social_event_config
->get('invite_enroll'),
];
$group_types = [];
/** @var \Drupal\group\Entity\GroupType $group_type */
foreach (GroupType::loadMultiple() as $group_type) {
$group_types[$group_type
->id()] = $group_type
->label();
}
$form['invite_group_types'] = [
'#type' => 'checkboxes',
'#title' => $this
->t('Enable event invite per group type'),
'#description' => $this
->t('Select the group types for which you want to enable the event invite feature.'),
'#options' => $group_types,
'#default_value' => $social_event_config
->get('invite_group_types'),
];
$form['invite_subject'] = [
'#type' => 'textfield',
'#title' => $this
->t('Subject'),
'#default_value' => $social_event_config
->get('invite_subject'),
'#required' => TRUE,
];
$form['invite_message'] = [
'#type' => 'textarea',
'#title' => $this
->t('Message'),
'#default_value' => $social_event_config
->get('invite_message'),
'#required' => TRUE,
];
$form['invite_helper'] = [
'#type' => 'textarea',
'#title' => $this
->t('Helper'),
'#default_value' => $social_event_config
->get('invite_helper'),
'#required' => TRUE,
'#rows' => '2',
];
$form['email_verification'] = [
'#type' => 'checkbox',
'#title' => t('Allow invited user to skip email verification'),
'#default_value' => $social_event_config
->get('email_verification'),
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#button_type' => 'primary',
'#button_level' => 'raised',
'#value' => $this
->t('Save configuration'),
];
return $form;
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this->configFactory
->getEditable('social_event_invite.settings');
$config
->set('invite_enroll', $form_state
->getValue('invite_enroll'));
$config
->set('invite_group_types', $form_state
->getValue('invite_group_types'));
$config
->set('invite_message', $form_state
->getValue('invite_message'));
$config
->set('invite_subject', $form_state
->getValue('invite_subject'));
$config
->set('invite_helper', $form_state
->getValue('invite_helper'));
$config
->set('email_verification', $form_state
->getValue('email_verification'));
$config
->save();
}
/**
* Gets the configuration names that will be editable.
*/
protected function getEditableConfigNames() {
// @todo Implement getEditableConfigNames() method.
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigFormBase:: |
public static | function |
Instantiates a new instance of this class. Overrides FormBase:: |
18 |
ConfigFormBase:: |
public | function | Constructs a \Drupal\system\ConfigFormBase object. | 16 |
ConfigFormBaseTrait:: |
protected | function | Retrieves a configuration object. | |
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
public | function | 2 | |
DependencySerializationTrait:: |
public | function | 2 | |
EventInviteSettingsForm:: |
public | function |
Form constructor. Overrides ConfigFormBase:: |
|
EventInviteSettingsForm:: |
protected | function |
Gets the configuration names that will be editable. Overrides ConfigFormBaseTrait:: |
|
EventInviteSettingsForm:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
|
EventInviteSettingsForm:: |
public | function |
Form submission handler. Overrides ConfigFormBase:: |
|
EventInviteSettingsForm:: |
public | function |
Form validation handler. Overrides FormBase:: |
|
FormBase:: |
protected | property | The config factory. | 3 |
FormBase:: |
protected | property | The request stack. | 1 |
FormBase:: |
protected | property | The route match. | |
FormBase:: |
protected | function | Gets the config factory for this form. | 3 |
FormBase:: |
private | function | Returns the service container. | |
FormBase:: |
protected | function | Gets the current user. | |
FormBase:: |
protected | function | Gets the request object. | |
FormBase:: |
protected | function | Gets the route match. | |
FormBase:: |
protected | function | Gets the logger for a specific channel. | |
FormBase:: |
protected | function | Returns a redirect response object for the specified route. | |
FormBase:: |
public | function | Resets the configuration factory. | |
FormBase:: |
public | function | Sets the config factory for this form. | |
FormBase:: |
public | function | Sets the request stack object to use. | |
LoggerChannelTrait:: |
protected | property | The logger channel factory service. | |
LoggerChannelTrait:: |
protected | function | Gets the logger for a specific channel. | |
LoggerChannelTrait:: |
public | function | Injects the logger channel factory. | |
MessengerTrait:: |
protected | property | The messenger. | 27 |
MessengerTrait:: |
public | function | Gets the messenger. | 27 |
MessengerTrait:: |
public | function | Sets the messenger. | |
RedirectDestinationTrait:: |
protected | property | The redirect destination service. | 1 |
RedirectDestinationTrait:: |
protected | function | Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url. | |
RedirectDestinationTrait:: |
protected | function | Returns the redirect destination service. | |
RedirectDestinationTrait:: |
public | function | Sets the redirect destination service. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |