function media_field_widget_value in D7 Media 7.3
Same name and namespace in other branches
- 7.4 includes/media.fields.inc \media_field_widget_value()
- 7 includes/media.fields.inc \media_field_widget_value()
- 7.2 includes/media.fields.inc \media_field_widget_value()
The #value_callback for the media field element.
1 string reference to 'media_field_widget_value'
- media_field_widget_form in includes/
media.fields.inc - Implements hook_field_widget_form().
File
- includes/
media.fields.inc, line 209 - Provide media selector widget and media field formatters to the fields API.
Code
function media_field_widget_value($element, $input = FALSE, $form_state = array()) {
if ($input) {
// Checkboxes lose their value when empty.
// If the display field is present make sure its unchecked value is saved.
$field = field_widget_field($element, $form_state);
if (empty($input['display'])) {
$input['display'] = !empty($field['settings']['display_field']) ? 0 : 1;
}
}
// We depend on the media element to handle uploads.
$return = media_file_value($element, $input, $form_state);
// Ensure that all the required properties are returned even if empty.
$return += array(
'fid' => 0,
'display' => 1,
'description' => '',
);
return $return;
}