function heartbeat_comments_form in Heartbeat 7
Same name and namespace in other branches
- 6.4 modules/heartbeat_comments/heartbeat_comments.module \heartbeat_comments_form()
Heartbeat comments form
1 string reference to 'heartbeat_comments_form'
- HeartbeatActivityCommentsPlugin::renderAttachmentsContent in modules/
heartbeat_comments/ plugins/ activitycomments.inc - renderAttachmentsContent().
File
- modules/
heartbeat_comments/ heartbeat_comments.module, line 311 - Heartbeat comments for activity.
Code
function heartbeat_comments_form($form, &$form_state, HeartbeatActivity $heartbeatActivity) {
$uaid = $heartbeatActivity->uaid;
$node_comment = $heartbeatActivity->additions->plugins['activitycomments']->isNodeComment;
$nid = $heartbeatActivity->nid;
$show_form = user_access('add heartbeat comment');
if ($show_form) {
$form['message'] = array(
'#title' => t('React'),
'#type' => 'textarea',
'#required' => TRUE,
'#rows' => 1,
'#resizable' => FALSE,
'#attributes' => array(
'class' => array(
'heartbeat-message-comment',
'autoGrow',
),
),
);
$form['heartbeat_comment_token'] = array(
'#default_value' => drupal_get_token('heartbeat_comment_' . $uaid),
'#type' => 'hidden',
'#attributes' => array(
'class' => array(
'heartbeat-message-token',
),
),
);
$form['uaid'] = array(
'#type' => 'hidden',
'#value' => $uaid,
'#attributes' => array(
'class' => array(
'heartbeat-message-uaid',
),
),
);
if ($nid && $node_comment) {
$show_form = user_access('post comments');
if ($show_form) {
$form['node_comment'] = array(
'#type' => 'hidden',
'#value' => 1,
'#attributes' => array(
'class' => array(
'heartbeat-message-node-comment',
),
),
);
$form['nid'] = array(
'#type' => 'hidden',
'#value' => $nid,
'#attributes' => array(
'class' => array(
'heartbeat-message-nid',
),
),
);
}
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
'#prefix' => '<span class="heartbeat-comments-wrapper">',
'#suffix' => '<span class="heartbeat-messages-throbber"> </span></span>',
'#attributes' => array(
'class' => array(
'heartbeat-comment-submit',
),
),
);
}
return $form;
}