custom theme

Using MediaElement.js with audio files Media 7.x-1.x

Media module doesn't come with a built-in audio player, but will work with MediaElement.js. MediaElement.js does not provide field formatters for Media 1.x's deprecated Multimedia asset field type, so it takes a bit of work to make them work together.

One approach would be to use hook_field_formatter_info_alter() on MediaElement module's mediaelement_field_formatter_info() to allow it to be used as a Multimedia asset field formatter, or to just write a custom field formatter that would tie Media and MediaElement together. If you want to be able to work with your theme using Display Suite, Panels, or core Fields UI, that might be the way to go.

Another approach is to do everything in the template files. The following code sample assumes you've created a Multimedia asset field for audio called field_audio, with only one value, and nothing translated.

In your theme's template.php (replace YOURTHEME with the name of your theme):

<?php
function YOURTHEME_preprocess_node(&$variables, $hook) {
$node = $vars['node'];

// if there is an audio file available
if (isset($node->field_audio['und'][0]['fid'])) {

Read more

modify views output at field level

This is how we can modify view output at field level

There is issues with theme_views_view_field($vars) API that when we implement this we will get error like
views-view-list.tpl.php (File not found, in folder ./), issue reference http://drupal.org/node/363182

We can avoid this issue as below :

function THEMENAME_views_view_field__VIEWID__DISPLAY__FIELDNAME($vars){
}

EXAMPLE:
function mytheme_views_view_field__myviewid__page__myfield($vars){
//this will  modify output  for field "myfield" in view id "myview" for "page" display.
}
Subscribe with RSS Syndicate content