You are here

function quote_form_alter in Quote 7.2

Same name and namespace in other branches
  1. 8.2 quote.module \quote_form_alter()
  2. 5 quote.module \quote_form_alter()
  3. 6.2 quote.module \quote_form_alter()
  4. 6 quote.module \quote_form_alter()
  5. 7 quote.module \quote_form_alter()

Implements hook_form_alter().

File

./quote.module, line 135
Allows users to quote posts or comments.

Code

function quote_form_alter(&$form, &$form_state, $form_id) {

  /*if ($form['#id'] == 'comment-form' &&
    isset($_GET['node-quote-all-reply-nid'])) {
    $node = node_load($_GET['node-quote-all-reply-nid']);
    $user = user_load($node->uid);
    $language = $form['comment_body']['#language'];
    $form['comment_body'][$language][0]['#default_value'] =
    '<blockquote><strong>' . $user->name . ' wrote:</strong> ' .
    $node->body['und'][0]['value'] . '</blockquote>';
    }*/
  if ($form['#id'] == 'comment-form' && isset($_GET['comment-quote-all-reply'])) {
    $comment = comment_load($_GET['comment-quote-all-reply']);
    $user = user_load($comment->uid);
    $language = $form['comment_body']['#language'];
    $limit = variable_get('quote_limit', 400);
    $comment_limit = substr($comment->comment_body[LANGUAGE_NONE][0]['value'], 0, $limit);
    $form['comment_body'][$language][0]['#default_value'] = '<blockquote><strong>' . $user->name . ' wrote:</strong> ' . $comment_limit . '</blockquote><p><br/></p>';
  }
}