function Notifications_Field_Select::element_edit in Notifications 7
Build a form element to edit this field
Overrides Notifications_Field::element_edit
File
- ./
notifications.field.inc, line 451 - Drupal Notifications Framework - Default class file
Class
- Notifications_Field_Select
- Field with selectable values
Code
function element_edit($element = array()) {
$element += array(
'#required' => TRUE,
'#title' => $this
->get_title(),
);
$options = $this
->select_options();
// If not required or not current value, add an empty value at the beginning
if (empty($element['#required'])) {
$options = array(
'' => '',
) + $options;
}
$element += array(
'#type' => 'select',
'#options' => $options,
'#default_value' => $this
->get_value(),
);
return $element;
}