public function EventSettingsForm::buildForm in Open Social 10.0.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_event/src/Form/EventSettingsForm.php \Drupal\social_event\Form\EventSettingsForm::buildForm()
- 8 modules/social_features/social_event/src/Form/EventSettingsForm.php \Drupal\social_event\Form\EventSettingsForm::buildForm()
- 8.2 modules/social_features/social_event/src/Form/EventSettingsForm.php \Drupal\social_event\Form\EventSettingsForm::buildForm()
- 8.3 modules/social_features/social_event/src/Form/EventSettingsForm.php \Drupal\social_event\Form\EventSettingsForm::buildForm()
- 8.4 modules/social_features/social_event/src/Form/EventSettingsForm.php \Drupal\social_event\Form\EventSettingsForm::buildForm()
- 8.5 modules/social_features/social_event/src/Form/EventSettingsForm.php \Drupal\social_event\Form\EventSettingsForm::buildForm()
- 8.6 modules/social_features/social_event/src/Form/EventSettingsForm.php \Drupal\social_event\Form\EventSettingsForm::buildForm()
- 8.7 modules/social_features/social_event/src/Form/EventSettingsForm.php \Drupal\social_event\Form\EventSettingsForm::buildForm()
- 8.8 modules/social_features/social_event/src/Form/EventSettingsForm.php \Drupal\social_event\Form\EventSettingsForm::buildForm()
- 10.3.x modules/social_features/social_event/src/Form/EventSettingsForm.php \Drupal\social_event\Form\EventSettingsForm::buildForm()
- 10.1.x modules/social_features/social_event/src/Form/EventSettingsForm.php \Drupal\social_event\Form\EventSettingsForm::buildForm()
- 10.2.x modules/social_features/social_event/src/Form/EventSettingsForm.php \Drupal\social_event\Form\EventSettingsForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- modules/
social_features/ social_event/ src/ Form/ EventSettingsForm.php, line 35
Class
- EventSettingsForm
- Class EventSettingsForm.
Namespace
Drupal\social_event\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
// Get the config.
$social_event_config = $this->configFactory
->getEditable('social_event.settings');
$form['enroll'] = [
'#type' => 'checkboxes',
'#title' => $this
->t('Enroll user which is not group member'),
'#description' => $this
->t('Enroll button should be visible for users that are not in the group and automatic enroll people to groups when they enroll to events that are part of the group.'),
'#default_value' => $social_event_config
->get('enroll'),
'#states' => [
'visible' => [
':input[name="enroll"]' => [
'checked' => TRUE,
],
],
],
];
/** @var \Drupal\group\Entity\GroupTypeInterface $group_type */
foreach (GroupType::loadMultiple() as $group_type) {
// Check if this group type uses events.
if ($group_type
->hasContentPlugin('group_node:event')) {
// Add to the option array.
$form['enroll']['#options'][$group_type
->id()] = $group_type
->label();
}
}
$form['address_visibility_settings'] = [
'#type' => 'checkboxes',
'#title' => $this
->t('Address visibility settings'),
'#options' => [
'street_code_private' => $this
->t('Only show street and postal code to event enrolees'),
],
'#default_value' => $social_event_config
->get('address_visibility_settings'),
];
$form['show_user_timezone'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Display user’s time zone in events'),
'#description' => $this
->t('If enabled, user’s own time zone will be displayed after the event date and time.'),
'#default_value' => $social_event_config
->get('show_user_timezone'),
];
return parent::buildForm($form, $form_state);
}