function quote_node_view in Quote 7.2
Same name and namespace in other branches
- 7 quote.module \quote_node_view()
Implements hook_node_view().
File
- ./
quote.module, line 32 - Allows users to quote posts or comments.
Code
function quote_node_view($node, $view_mode) {
if (user_access('post comments') && user_access('use quote') && in_array($node->type, array_filter(variable_get('quote_allow_types'))) && $node->comment == COMMENT_NODE_OPEN) {
drupal_add_js(drupal_get_path('module', 'quote') . '/js/quote.js');
drupal_add_js([
'quote' => [
'quote_selector' => variable_get('quote_selector', '#edit-comment-body textarea'),
'quote_limit' => variable_get('quote_limit', '400'),
'quote_selector_comment_quote_all' => variable_get('quote_selector_comment_quote_all', '.field-name-comment-body'),
'quote_selector_node_quote_all' => variable_get('quote_selector_node_quote_all', '.field-name-body'),
'quote_ckeditor_support' => variable_get('quote_ckeditor_support', 'FALSE'),
],
], [
'type' => 'setting',
]);
if (variable_get('quote_modes_quote_sel', TRUE)) {
$links['node-quote-sel'] = [
'title' => t('quote selected'),
'href' => '#',
'query' => '',
'fragment' => '',
];
$node->content['links']['comment']['#links']['node-quote-sel'] = $links['node-quote-sel'];
}
if (variable_get('quote_modes_quote_all', TRUE)) {
$links['node-quote-all'] = [
'title' => t('quote all'),
'href' => '#',
'query' => '',
'fragment' => '',
];
$node->content['links']['comment']['#links']['node-quote-all'] = $links['node-quote-all'];
}
/*$links['node-quote-all-reply'] = [
'title' => t('reply and quote all'),
'href' => "comment/reply/$node->nid/",
'query' => ['node-quote-all-reply-nid' => $node->nid],
'fragment' => ''
];
$node->content['links']['comment']['#links']['node-quote-all-reply'] = $links['node-quote-all-reply'];*/
}
}