You are here

function html5_media_get_attributes in HTML5 Media 7

Returns the settings for this video or audio element.

1 call to html5_media_get_attributes()
html5_media_field_formatter_view in ./html5_media.module
Implements hook_field_formatter_view().

File

./html5_media.module, line 415

Code

function html5_media_get_attributes($settings) {
  $attributes = array();
  $element_settings = array(
    'preload',
    'autoplay',
    'loop',
  );
  foreach ($settings as $name => $value) {
    if ($value && in_array($name, $element_settings)) {
      $attributes[$name] = NULL;
    }
  }

  // Set the ID, width and height.
  $attributes['id'] = $settings['id'] . '-player';
  $attributes['class'] = 'minplayer-' . $settings['template'] . '-media';
  $attributes['width'] = '100%';
  $attributes['height'] = '100%';
  return $attributes;
}