public function SocialProfileSettingsForm::buildForm in Open Social 10.3.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::buildForm()
- 8 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::buildForm()
- 8.2 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::buildForm()
- 8.3 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::buildForm()
- 8.4 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::buildForm()
- 8.5 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::buildForm()
- 8.6 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::buildForm()
- 8.7 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::buildForm()
- 8.8 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::buildForm()
- 10.0.x modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::buildForm()
- 10.1.x modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::buildForm()
- 10.2.x modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::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_profile/ src/ Form/ SocialProfileSettingsForm.php, line 78
Class
- SocialProfileSettingsForm
- Configure social profile settings.
Namespace
Drupal\social_profile\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('social_profile.settings');
$form['privacy'] = [
'#type' => 'details',
'#title' => $this
->t('Privacy settings'),
'#open' => TRUE,
];
$form['privacy']['social_profile_show_email'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Show email on all user profiles'),
'#default_value' => $config
->get('social_profile_show_email'),
'#description' => $this
->t('When enabled, users are not able to hide their email address on their profile. When disabled, users will be able to control the visibility of their emailaddress.'),
];
// Check if the website is multilingual.
if ($this->languageMananger
->isMultilingual()) {
$form['privacy']['social_profile_show_language'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Show language on all user profiles'),
'#default_value' => $config
->get('social_profile_show_language'),
'#description' => $this
->t('When enabled, users are not able to hide their preferred language on their profile. When disabled, users will be able to control the visibility of their language preference.'),
];
}
$form['tagging'] = [
'#type' => 'details',
'#title' => $this
->t('Tag settings'),
'#open' => TRUE,
];
// Get profile vocabulary overview page link.
$profile_tags = Link::createFromRoute('profile tags', 'entity.taxonomy_vocabulary.overview_form', [
'taxonomy_vocabulary' => 'profile_tag',
]);
$form['tagging']['enable_profile_tagging'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Allow profile tagging for content managers'),
'#required' => FALSE,
'#default_value' => $config
->get('enable_profile_tagging'),
'#description' => $this
->t('Determine whether content managers are allowed to add @profile_tags terms to the users profile.', [
'@profile_tags' => $profile_tags
->toString(),
]),
];
$form['tagging']['allow_tagging_for_lu'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Allow profile tagging for regular users'),
'#default_value' => $config
->get('allow_tagging_for_lu'),
'#required' => FALSE,
'#description' => $this
->t("Determine whether regular users are allowed to add profile tags to their own profile."),
'#states' => [
'visible' => [
':input[name="enable_profile_tagging"]' => [
'checked' => TRUE,
],
],
],
];
$form['tagging']['allow_category_split'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Allow category split'),
'#default_value' => $config
->get('allow_category_split'),
'#required' => FALSE,
'#description' => $this
->t("Determine if the main categories of the vocabulary will be used as separate tag fields or as a single tag field when using tags on profile."),
];
$form['tagging']['use_category_parent'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Allow parents to be used as tag'),
'#default_value' => $config
->get('use_category_parent'),
'#required' => FALSE,
'#description' => $this
->t("Determine if the parent of categories will be used with children tags."),
'#states' => [
'visible' => [
':input[name="allow_category_split"]' => [
'checked' => TRUE,
],
],
],
];
return parent::buildForm($form, $form_state);
}