function _media_field_get_description_from_element in D7 Media 7.2
Same name and namespace in other branches
- 7.4 includes/media.fields.inc \_media_field_get_description_from_element()
- 7.3 includes/media.fields.inc \_media_field_get_description_from_element()
Retrieves the file description from a media field element.
This helper function is used by media_field_widget_process_multiple().
Parameters
array $element: The element being processed.
Return value
A description of the file suitable for use in the administrative interface.
1 call to _media_field_get_description_from_element()
- media_field_widget_process_multiple in includes/
media.fields.inc - An element #process callback for a group of media fields.
File
- includes/
media.fields.inc, line 401 - Provide media selector widget and media field formatters to the fields API.
Code
function _media_field_get_description_from_element($element) {
// Use the actual file description, if it's available.
if (!empty($element['#default_value']['description'])) {
return $element['#default_value']['description'];
}
// Otherwise, fall back to the filename.
if (!empty($element['#default_value']['filename'])) {
return $element['#default_value']['filename'];
}
// This is probably a newly uploaded file; no description is available.
return FALSE;
}