function _notifications_forum_send_element in Forum notifications 7
1 call to _notifications_forum_send_element()
File
- ./
notifications_forum.module, line 185
Code
function _notifications_forum_send_element(&$wrapper, $type, $title, $sub, $account) {
$options = $type === 'send_method' ? notifications_send_methods($account) : notifications_send_intervals($account);
$default = !is_null($sub) ? $sub->{$type} : notifications_user_setting($type, $account);
// if we have no default from the subscription or the settings, just take the
// first option (the first array value is returned by reset()).
$default = !is_null($default) ? $default : reset($options);
$element = array(
'#title' => $title,
);
if (count($options) > 1) {
$element = array_merge($element, array(
'#type' => 'select',
'#options' => $options,
'#default_value' => $default,
));
}
else {
$element = array_merge($element, array(
'#type' => 'hidden',
'#value' => $default,
));
}
$wrapper[$type] = $element;
}