You are here

function social_ajax_comments_form_comment_post_comment_delete_form_alter in Open Social 8.8

Same name and namespace in other branches
  1. 8.9 modules/custom/social_ajax_comments/social_ajax_comments.module \social_ajax_comments_form_comment_post_comment_delete_form_alter()
  2. 10.3.x modules/custom/social_ajax_comments/social_ajax_comments.module \social_ajax_comments_form_comment_post_comment_delete_form_alter()
  3. 10.0.x modules/custom/social_ajax_comments/social_ajax_comments.module \social_ajax_comments_form_comment_post_comment_delete_form_alter()
  4. 10.1.x modules/custom/social_ajax_comments/social_ajax_comments.module \social_ajax_comments_form_comment_post_comment_delete_form_alter()
  5. 10.2.x modules/custom/social_ajax_comments/social_ajax_comments.module \social_ajax_comments_form_comment_post_comment_delete_form_alter()

Implements hook_form_FORM_ID_alter().

Triggers on form for deleting a comment on a post.

File

modules/custom/social_ajax_comments/social_ajax_comments.module, line 66
Social AJAX comments module file.

Code

function social_ajax_comments_form_comment_post_comment_delete_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  // We set a new class, so we can remove wrapper div.
  // Due to the form.inc and confirm-form twig setup.
  if (\Drupal::request()
    ->isXmlHttpRequest()) {
    $form['#attributes']['class'][] = 'is_modal';
  }
}