You are here

function _quote_get_quoted_data in Quote 6.2

Same name and namespace in other branches
  1. 7 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
  • name: Display name of the object's author
1 call to _quote_get_quoted_data()
quote_form_alter in ./quote.module
Implementation of hook_form_alter().

File

./quote.module, line 297
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) {
  global $user;
  $ret = array();
  if ($cid) {
    $quoted_comment = _comment_load($cid);
    $quoted_user_name = $quoted_comment->name != '' ? $quoted_comment->name : variable_get('anonymous', 'Anonymous');
    $quoted_content = $quoted_comment->comment;
  }
  else {
    $quoted_node = node_load($nid);
    $quoted_user_name = $quoted_node->name != '' ? $quoted_node->name : variable_get('anonymous', 'Anonymous');
    $quoted_content = $quoted_node->body;
  }
  if (_quote_variable_get('format')) {
    $quoted_content = check_markup($quoted_content, _quote_variable_get('format'), FALSE);
  }
  $ret = array(
    'content' => $quoted_content,
    'name' => $quoted_user_name,
  );
  return $ret;
}