function node_makemeeting_simplepoll_form in Make Meeting Scheduler 6
Parameters
mixed $node:
File
- ./
makemeeting_simplepoll.module, line 185 - Make Meeting Simple Poll module
Code
function node_makemeeting_simplepoll_form(&$node) {
global $user;
$type = node_get_types('type', $node);
if ($type->has_title) {
$form['title'] = array(
'#type' => 'textfield',
'#title' => check_plain($type->title_label),
'#required' => TRUE,
'#default_value' => $node->title,
'#weight' => -5,
);
}
if ($type->has_body) {
$form['body'] = array(
'#type' => 'textarea',
'#title' => check_plain($type->body_label),
'#default_value' => $node->body,
'#rows' => 5,
);
}
if (isset($node->nid) && $node->uid == 0 || $user->uid == 0) {
$form['anonym'] = array(
'#type' => 'fieldset',
'#title' => t('Add your name and email'),
'#tree' => TRUE,
);
$form['anonym']['user_name'] = array(
'#type' => 'textfield',
'#title' => t('Your name'),
'#maxlength' => 100,
'#description' => t('This is optional.'),
);
$form['anonym']['user_email'] = array(
'#type' => 'textfield',
'#title' => t('Your e-mail'),
'#description' => t('This is optional, too. But if you add, we can send e-mail notification after every valid vote.'),
'#maxlength' => 100,
);
}
if (!isset($node->nid)) {
$answers = array(
'field0' => t('Sample answer #1'),
'field1' => t('Sample answer #2'),
);
}
else {
$answers = $node->answers;
}
$form['ans'] = array(
'#type' => 'fieldset',
'#title' => t('Answers'),
'#tree' => TRUE,
'#description' => t('You can add extra field with the link at the bottom of the form fields.'),
);
$form['ans']['answers'] = array(
'#type' => 'makemeeting_simplepoll_form',
'#title' => t('Poll answers'),
'#attributes' => array(
'answers' => $answers,
),
);
$form['poll_options'] = array(
'#type' => 'fieldset',
'#title' => t('Poll options'),
'#tree' => TRUE,
);
$form['poll_options']['secure'] = array(
'#type' => 'radios',
'#title' => t('Show previous votes'),
'#description' => t("Deny new voters to see the previous votes."),
'#options' => array(
'0' => t('Yes'),
'1' => t('No'),
),
'#default_value' => isset($node->secure) ? $node->secure : 0,
);
$form['poll_options']['multiple_allowed'] = array(
'#type' => 'radios',
'#title' => t('Multiple option is selectable per answers.'),
'#options' => array(
'0' => t('Disabled'),
'1' => t('Enabled'),
),
'#default_value' => isset($node->multiple_allowed) ? $node->multiple_allowed : 0,
);
$form['email'] = array(
'#type' => 'fieldset',
'#title' => t('E-mail notification'),
);
$form['email']['email_notification'] = array(
'#type' => 'radios',
'#title' => t('Send me an e-mail after every valid vote'),
'#options' => array(
'1' => t('Yes'),
'0' => t('No'),
),
'#default_value' => isset($node->email_notification) ? $node->email_notification : 1,
);
return $form;
}