public function SocialGroupSettings::buildForm in Open Social 10.3.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_group/src/Form/SocialGroupSettings.php \Drupal\social_group\Form\SocialGroupSettings::buildForm()
- 8 modules/social_features/social_group/src/Form/SocialGroupSettings.php \Drupal\social_group\Form\SocialGroupSettings::buildForm()
- 8.2 modules/social_features/social_group/src/Form/SocialGroupSettings.php \Drupal\social_group\Form\SocialGroupSettings::buildForm()
- 8.3 modules/social_features/social_group/src/Form/SocialGroupSettings.php \Drupal\social_group\Form\SocialGroupSettings::buildForm()
- 8.4 modules/social_features/social_group/src/Form/SocialGroupSettings.php \Drupal\social_group\Form\SocialGroupSettings::buildForm()
- 8.5 modules/social_features/social_group/src/Form/SocialGroupSettings.php \Drupal\social_group\Form\SocialGroupSettings::buildForm()
- 8.6 modules/social_features/social_group/src/Form/SocialGroupSettings.php \Drupal\social_group\Form\SocialGroupSettings::buildForm()
- 8.7 modules/social_features/social_group/src/Form/SocialGroupSettings.php \Drupal\social_group\Form\SocialGroupSettings::buildForm()
- 8.8 modules/social_features/social_group/src/Form/SocialGroupSettings.php \Drupal\social_group\Form\SocialGroupSettings::buildForm()
- 10.0.x modules/social_features/social_group/src/Form/SocialGroupSettings.php \Drupal\social_group\Form\SocialGroupSettings::buildForm()
- 10.1.x modules/social_features/social_group/src/Form/SocialGroupSettings.php \Drupal\social_group\Form\SocialGroupSettings::buildForm()
- 10.2.x modules/social_features/social_group/src/Form/SocialGroupSettings.php \Drupal\social_group\Form\SocialGroupSettings::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_group/ src/ Form/ SocialGroupSettings.php, line 38
Class
- SocialGroupSettings
- Settings form which enables site managers to configure different options.
Namespace
Drupal\social_group\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('social_group.settings');
$form['permissions'] = [
'#type' => 'checkboxes',
'#title' => $this
->t('Group permissions'),
'#options' => [
'allow_group_create' => $this
->t('Allow regular users to create new groups'),
'allow_group_selection_in_node' => $this
->t('Allow regular users to change the group their content belong to'),
'address_visibility_settings' => $this
->t('Only show the group address to the group members'),
],
'#weight' => 10,
];
foreach (array_keys($form['permissions']['#options']) as $permission) {
if ($this
->hasPermission($permission)) {
$form['permissions']['#default_value'][] = $permission;
}
}
$form['default_hero'] = [
'#type' => 'radios',
'#title' => $this
->t('Default group hero size'),
'#description' => $this
->t('The default hero size used on this platform. Only applicable when logged-in users cannot choose a different hero size on each group.'),
'#default_value' => $config
->get('default_hero'),
'#options' => $this
->getCropTypes(),
'#weight' => 20,
];
// Add an option for site manager to enable/disable option to choose group
// type on page to add flexible groups.
if (\Drupal::moduleHandler()
->moduleExists('social_group_flexible_group')) {
$form['social_group_type_required'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Require group types'),
'#description' => $this
->t('When checked, a new option will appear on
the flexible group form which requires group creators to select a
group type, this allows for a better categorisation of groups in your
community. You can add or edit the available group types @link', [
'@link' => Link::fromTextAndUrl('here.', Url::fromUserInput('/admin/structure/taxonomy/manage/group_type/overview'))
->toString(),
]),
'#default_value' => $config
->get('social_group_type_required'),
];
}
return parent::buildForm($form, $form_state);
}