'; // Alternate content $return[] = $element['#value']; // Close the audio tag $return[] = ''; // Format the result nicely $return = embed_format_output($return); // Return the result return $return; } /** * Clear object attributes that aren't valid on the audio tag. * * @param $element * The element to be modified. * @return * Nothing - the element is modified directly by reference. */ function embed_audio_unset_object_attributes(&$element) { // Unset object attributes that are not valid for audio tag $attributes = array( 'data', 'type', 'name', 'usemap', 'form', 'width', 'height', ); foreach ($attributes as $attribute) { unset($element['#attributes'][$attribute]); } return; } /** * Set additional attributes on the audio object. * * @param $element * The element to be modified. * @return * Nothing - the element is modified directly by reference. */ function embed_audio_set_audio_attributes(&$element) { // There may be other valid attributes to be moved from #object_data to #attributes $attributes = array( 'autobuffer', 'autoplay', 'loop', 'controls', ); foreach ($attributes as $attribute) { if (isset($element['#object_data'][$attribute])) { $element['#attributes'][$attribute] = $attribute; } } return; }