function notifications_subscription_form_field in Notifications 6
Same name and namespace in other branches
- 6.2 notifications.module \notifications_subscription_form_field()
- 6.3 notifications.module \notifications_subscription_form_field()
Display a form field for a notifications_field
2 calls to notifications_subscription_form_field()
- notifications_add_subscription_form in ./
notifications.pages.inc - Form for creating new subscriptions
- notifications_custom_fields_form in notifications_custom/
notifications_custom.admin.inc - Fields form
File
- ./
notifications.module, line 1607 - Notifications module
Code
function notifications_subscription_form_field($type, $value = NULL) {
$info = notifications_subscription_fields($type);
if (!empty($info['options callback'])) {
$element['#type'] = 'select';
$element['#options'] = call_user_func($info['options callback']);
}
elseif (!empty($info['autocomplete path'])) {
$element['#type'] = 'textfield';
$element['#autocomplete_path'] = $info['autocomplete path'];
if ($value) {
if (!empty($info['autocomplete callback'])) {
$value = call_user_func($info['autocomplete callback'], $value);
}
elseif (!empty($info['format callback'])) {
$value = call_user_func($info['format callback'], $value, FALSE);
}
}
}
else {
$element['#type'] = 'textfield';
if ($value) {
$value = check_plain($value);
}
}
if ($value) {
$element['#default_value'] = $value;
}
return $element;
}