Project

General

Profile

« Previous | Next » 

Revision 275b2642

Added by Andreas Kohlbecker over 7 years ago

fix #5948 supressing media when uri is missing, also turning theme function into plain markup function

View differences:

modules/cdm_dataportal/theme/cdm_dataportal.media.theme
52 52
}
53 53

  
54 54
/**
55
 * @todo Please document this function.
56
 * @see http://drupal.org/node/1354
55
 * Creates the markup for the media associated a DescriptionElement instance.
56
 *
57
 * @param $descriptionElement
58
 *    the DescriptionElement instance
59
 * @param $mimeTypePreference array
60
 *    An array of mime type strings. the order of the mimetpes is the oerder of preference.
61
 *    E.g.: array('application/pdf','image/jpeg')
62
 *
63
 * @return string
64
 *    The markup
57 65
 */
58
function theme_cdm_media($variables) {
59
  $descriptionElement = $variables['descriptionElement'];
60
  $mimeTypePreference = $variables['mimeTypePreference'];
66
function cdm_description_element_media($descriptionElement, $mimeTypePreference) {
67

  
61 68
  $out = '';
62 69

  
63 70
  _add_js_thickbox();
64 71

  
65
  $uuid = $descriptionElement->uuid;
66 72
  $feature = $descriptionElement->feature;
67 73
  $medias = $descriptionElement->media;
68 74

  
......
76 82
      $out .= theme('cdm_media_mime_' . $contentTypeDirectory, array('mediaRepresentation' => $mediaRepresentation, 'feature' => $feature));
77 83
    }
78 84
    else {
79
      // No media available, so display just the type term.
80
      $out .= $feature->representation_L10n;
85
      // Media has empty or corrupt representation
86
      if(user_is_logged_in()){
87
        drupal_set_message('The media entity (' . l($media->uuid, path_to_media($media->uuid)) .') has empty or corrupt representation parts. Maybe the URI is empty.' , 'warning');
88
      }
81 89
    }
82 90
  }
83 91
  return $out;

Also available in: Unified diff