You are here

function _quote_get_quoted_data in Quote 7

Same name and namespace in other branches
  1. 6.2 quote.module \_quote_get_quoted_data()

Retrieve the content to be quoted.

Parameters

$nid: The referring node's ID.

$cid: The referring comment's ID (if applying).

Return value

array The referring object's data as:

  • content: Node body or comment content
  • author : Display name of the object's author
1 call to _quote_get_quoted_data()
quote_form_alter in ./quote.module
Implements hook_form_alter().

File

./quote.module, line 330
The quote module provides a filter and appropriate links that allow users to quote nodes and other comments in their own comments.

Code

function _quote_get_quoted_data($nid, $cid = NULL) {
  if ($cid) {
    $quoted_comment = comment_load($cid);
    $language = field_language('comment', $quoted_comment, 'comment_body', $quoted_comment->language);
    $quoted_user_name = check_plain(format_username(user_load($quoted_comment->uid)));
    $quoted_content = $quoted_comment->comment_body[$language][0]['value'];
  }
  else {
    $quoted_node = node_load($nid);
    $language = field_language('node', $quoted_node, 'body', $quoted_node->language);
    $quoted_user_name = check_plain(format_username(user_load($quoted_node->uid)));
    $quoted_content = $quoted_node->body[$language][0]['value'];
  }
  if (_quote_variable_get('format')) {
    $quoted_content = check_markup($quoted_content, _quote_variable_get('format'), $language);
  }
  $ret = array(
    'content' => $quoted_content,
    'author' => $quoted_user_name,
  );
  return $ret;
}