You are here

function oa_comment_preprocess_comment_form in OA Comment 7.2

Implements hook_preprocess_comment_form().

File

./oa_comment.theme.inc, line 229
Preprocess functions for comments.

Code

function oa_comment_preprocess_comment_form(&$vars) {
  $form = $vars['form'];

  // Make sure this is a modal.
  if (strpos($form['#action'], 'ajax') !== FALSE) {

    // Only show the parent comment in the modal if there is one.
    if (!empty($form['#entity']->pid)) {
      $cid = $form['#entity']->pid;
      $comment = comment_load($cid);
      $comment = comment_view($comment, $vars['form']['#node']);
      if (isset($comment)) {

        // Remove comment links in modal.
        $vars['comment_parent'] = drupal_render($comment);
      }
    }
  }
  $vars['paragraph_buttons'] = drupal_render($form['field_oa_related']);
  $vars['action_links'] = drupal_render($form['actions']);

  // Render the rest of the comment form.
  $vars['comment_form'] = drupal_render_children($form);
}