public function SocialCommentAdminOverview::submitForm in Open Social 8.8
Same name and namespace in other branches
- 8.9 modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::submitForm()
- 8.3 modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::submitForm()
- 8.4 modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::submitForm()
- 8.5 modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::submitForm()
- 8.6 modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::submitForm()
- 8.7 modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::submitForm()
- 10.3.x modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::submitForm()
- 10.0.x modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::submitForm()
- 10.1.x modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::submitForm()
- 10.2.x modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::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 FormInterface::submitForm
File
- modules/
social_features/ social_comment/ src/ Form/ SocialCommentAdminOverview.php, line 263
Class
- SocialCommentAdminOverview
- Provides the comments overview administration form.
Namespace
Drupal\social_comment\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$operation = $form_state
->getValue('operation');
$cids = $form_state
->getValue('comments');
/** @var \Drupal\comment\CommentInterface[] $comments */
$comments = $this->commentStorage
->loadMultiple($cids);
if ($operation != 'delete') {
foreach ($comments as $comment) {
if ($operation == 'unpublish') {
$comment
->setUnpublished();
}
elseif ($operation == 'publish') {
$comment
->setPublished();
}
$comment
->save();
}
drupal_set_message($this
->t('The update has been performed.'));
$form_state
->setRedirect('comment.admin');
}
else {
$info = [];
/** @var \Drupal\comment\CommentInterface $comment */
foreach ($comments as $comment) {
$langcode = $comment
->language()
->getId();
$info[$comment
->id()][$langcode] = $langcode;
}
$this->tempStoreFactory
->get('comment_multiple_delete_confirm')
->set($this
->currentUser()
->id(), $info);
$form_state
->setRedirect('comment.multiple_delete_confirm');
}
}