function signup_broadcast_form in Signup 7
Same name and namespace in other branches
- 5.2 signup.module \signup_broadcast_form()
- 6.2 includes/broadcast.inc \signup_broadcast_form()
- 6 includes/broadcast.inc \signup_broadcast_form()
Form builder for the signup broadcast form.
Parameters
stdClass $node: The node that the broadcast form is being attached to.
1 string reference to 'signup_broadcast_form'
- signup_menu in ./
signup.module - Implements hook_menu().
File
- includes/
broadcast.inc, line 13 - Code related to sending signup broadcast messages.
Code
function signup_broadcast_form($form, $form_state, $node) {
drupal_set_title($node->title);
$signups = signup_get_signups($node->nid);
if (empty($signups)) {
$form['no_users'] = array(
'#markup' => t('No users have signup up for this %node_type.', array(
'%node_type' => node_type_get_name($node->type),
)),
);
return $form;
}
$tokens = array(
'%node_title',
'%node_url',
'%user_mail',
'%user_name',
t('%cancel_signup_url (access to this link is denied to users without the "cancel own signups" permission)'),
);
if (_signup_get_node_scheduler($node) != 'none') {
$tokens = array_merge(array(
'%node_start_time',
), $tokens);
}
if (module_exists('token')) {
$token_text = t('Supported string substitutions: %tokens, and any tokens in the %replacement_tokens list.', array(
'%tokens' => implode(', ', $tokens),
'%replacement_tokens' => t('Replacement tokens'),
));
}
else {
$token_text = t('Supported string substitutions: %tokens.', array(
'%tokens' => implode(', ', $tokens),
));
}
$form['subject'] = array(
'#type' => 'textfield',
'#title' => t('Subject'),
'#required' => TRUE,
);
$form['message'] = array(
'#type' => 'textarea',
'#title' => t('Message body'),
'#required' => TRUE,
'#description' => t('Body of the email message you wish to send to all users who have signed up for this %node_type. !token_description', array(
'%node_type' => node_type_get_name($node->type),
'!token_description' => $token_text,
)),
'#rows' => 10,
);
if (module_exists('token')) {
module_load_include('inc', 'signup', 'includes/token_help');
_signup_token_help($form, 'message_tokens_fieldset');
}
$form['copy'] = array(
'#type' => 'checkbox',
'#title' => t('Send yourself a copy.'),
);
$form['send'] = array(
'#type' => 'submit',
'#value' => t('Send'),
);
$form['nid'] = array(
'#type' => 'value',
'#value' => $node->nid,
);
global $user;
if (user_access('administer site configuration')) {
$form['from'] = array(
'#type' => 'textfield',
'#title' => t('From'),
'#required' => TRUE,
'#default_value' => $user->mail,
'#weight' => '-10',
);
}
else {
$form['from'] = array(
'#markup' => t('This message will be sent from: %from', array(
'%from' => $user->mail,
)),
'#pre' => '<strong>',
'#post' => '</strong>',
);
}
return $form;
}