public function SocialProfileSettingsForm::submitForm in Open Social 8.9
Same name and namespace in other branches
- 8 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::submitForm()
- 8.2 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::submitForm()
- 8.3 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::submitForm()
- 8.4 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::submitForm()
- 8.5 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::submitForm()
- 8.6 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::submitForm()
- 8.7 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::submitForm()
- 8.8 modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::submitForm()
- 10.3.x modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::submitForm()
- 10.0.x modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::submitForm()
- 10.1.x modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::submitForm()
- 10.2.x modules/social_features/social_profile/src/Form/SocialProfileSettingsForm.php \Drupal\social_profile\Form\SocialProfileSettingsForm::submitForm()
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides ConfigFormBase::submitForm
File
- modules/
social_features/ social_profile/ src/ Form/ SocialProfileSettingsForm.php, line 107
Class
- SocialProfileSettingsForm
- Configure social profile settings.
Namespace
Drupal\social_profile\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// Save config.
$config = $this
->config('social_profile.settings');
$config
->set('social_profile_show_email', $form_state
->getValue('social_profile_show_email'))
->save();
// Check if the website is multilingual.
if ($this->languageMananger
->isMultilingual()) {
$config
->set('social_profile_show_language', $form_state
->getValue('social_profile_show_language'))
->save();
}
// Invalidate profile cache tags.
$query = $this->database
->select('profile', 'p');
$query
->addField('p', 'profile_id');
$query
->condition('p.type', 'profile');
$query
->condition('p.status', 1);
$ids = $query
->execute()
->fetchCol();
if (!empty($ids)) {
$cache_tags = [];
foreach ($ids as $id) {
$cache_tags[] = 'profile:' . $id;
}
Cache::invalidateTags($cache_tags);
}
parent::submitForm($form, $form_state);
}