summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reid2013-07-21 19:49:33 (GMT)
committer Dave Reid2013-07-21 19:49:33 (GMT)
commit2e68439a92dbf7e4f400ff5409678e2519558c29 (patch)
tree73d1df1c32d15b761eeaa7cf5c5854317efda38b
parentd460ba965b7da2c965f734b5560e843b883ca2e6 (diff)
Issue #2024609 by slucero, azinck, Dave Reid: Fixed field label missing from error message when a 'required' multiple-value media widget field is left empty.
-rw-r--r--includes/media.fields.inc5
-rw-r--r--media.module4
2 files changed, 8 insertions, 1 deletions
diff --git a/includes/media.fields.inc b/includes/media.fields.inc
index 25317d4..7551d45 100644
--- a/includes/media.fields.inc
+++ b/includes/media.fields.inc
@@ -169,6 +169,11 @@ function media_field_widget_form(&$form, &$form_state, $field, $instance, $langc
),
);
+ if ($field['cardinality'] != 1) {
+ $element['#title'] = check_plain($instance['label']);
+ $element['#title_display'] = 'invisible';
+ }
+
if ($field['type'] == 'file') {
$element['display'] = array(
'#type' => 'value',
diff --git a/media.module b/media.module
index fd59789..206ce4c 100644
--- a/media.module
+++ b/media.module
@@ -916,11 +916,13 @@ function media_element_process(&$element, &$form_state, $form) {
$element['title'] = array(
'#type' => 'item',
'#title' => $element['#title'],
- '#markup' => '',
'#description' => $element['#description'],
'#required' => $element['#required'],
'#weight' => -100,
);
+ if (isset($element['#title_display'])) {
+ $element['title']['#title_display'] = $element['#title_display'];
+ }
// @todo This should load from the JS in case of a failed form submission.
$element['preview'] = array(