function user_activeedit_links in Javascript Tools 5
File
- activeedit/
modules/ comment.inc, line 94
Code
function user_activeedit_links() {
$links = array();
// We only support comment editing if comments can be posted without preview.
if (variable_get('comment_preview', COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL) {
$links['comment_new'] = array(
'#title' => t('comment'),
'#marker' => 'comment/reply',
'#text' => t('Add new comment'),
'#parent' => 'div.links',
'#submit_text' => t('Post comment'),
'#access' => user_access('post comments'),
'#form' => array(
'comment_form' => array(),
),
);
$links['comment_reply'] = array(
'#title' => t('comment reply'),
'#marker' => 'comment/reply',
'#text' => t('reply'),
'#parent' => 'div.links',
'#submit_text' => t('Post comment'),
'#access' => user_access('post comments'),
'#form' => array(
'comment_form' => array(),
),
);
// We generate content separately, on demand, to avoid unneeded processing.
// Otherwise these calls would all be run on every page load.
if (isset($_POST) && $_POST['activeedit_submit'] && ($key = $_REQUEST['activeedit_id'])) {
$content = FALSE;
switch ($key) {
case 'comment_new':
case 'comment_reply':
$null = NULL;
$content = activeedit_comment($null, 'activeedit');
break;
}
if ($content) {
$links[$key]['#content'] = $content;
}
}
}
return $links;
}