function shouts_shout_form in Heartbeat 6.4
Same name and namespace in other branches
- 6.3 modules/shouts/shouts.module \shouts_shout_form()
Show the shoutform
1 string reference to 'shouts_shout_form'
- shouts_block in modules/
shouts/ shouts.module - Implementation of hook_block().
File
- modules/
shouts/ shouts.module, line 212 - Gives the possibility to the user to shout a message.
Code
function shouts_shout_form($form_state = array(), $show_latest_shout = TRUE) {
global $user;
$show_form = user_access('make shout');
$form = array();
if (empty($user->latest_shout) || !$show_latest_shout) {
$latest_shout->message = '';
$latest_shout->time = '';
}
else {
$latest_shout = $user->latest_shout;
}
if ($show_form) {
$form['#prefix'] = theme('shoutform_message', $latest_shout->message, false, $latest_shout->time);
$form['shout'] = array(
'#type' => 'textarea',
'#rows' => 1,
'#required' => TRUE,
/*'#resizable' => FALSE,*/
'#attributes' => array(
'class' => 'shout-message',
),
'#default_value' => t('What are you doing?'),
);
if ($show_latest_shout) {
$form['shout']['#title'] = t('Share');
}
$form['submit'] = array(
'#prefix' => '<span class="shouts-form-wrapper">',
'#suffix' => '<span class="heartbeat-messages-throbber"> </span></span>',
'#type' => 'submit',
'#value' => t('Shout'),
'#attributes' => array(
'class' => 'shout-submit',
'onclick' => 'javascript:Drupal.heartbeat.Shouts.shout(this, \'shout/post\'); return false;',
),
);
$form['heartbeat_shout_token'] = array(
'#id' => 'heartbeat_shout_post_' . $GLOBALS['user']->uid,
'#default_value' => drupal_get_token('heartbeat_shout_post_' . $GLOBALS['user']->uid),
'#type' => 'hidden',
);
}
return $form;
}