You are here

function swftools_views_add_playlist_element in SWF Tools 6.3

Adds a single element to the playlist.

This function is designed to be called by templates and it will take care of adding the fileurl, image and title to the playlist. These are the only defaults that SWF Tools takes care of by itself. For more advanced playlists it is required to create a customised views-view-swftools.tpl.php

Parameters

array $files: The playlist array (passed by reference).

int $key: The key in the array for this playlist element.

array $options: The options variable array for the view.

array $work: The results of rendering this row, keyed on field id.

Return value

nothing The $files array is passed by reference.

1 call to swftools_views_add_playlist_element()
views-view-swftools.tpl.php in views/views-view-swftools.tpl.php
Template for generating a Views based playlist and player.

File

views/swftools.views.theme.inc, line 48
Functions used as part of theming of content by the SWF Tools Views plug-in.

Code

function swftools_views_add_playlist_element(&$files, $key, $options, $work) {

  // Always attach the filepath
  $files[$key]['filepath'] = $work[$options['filepath']];

  // Attach other keys, using empty string if they are undefined
  $elements = array(
    'title',
    'image',
    'description',
    'author',
    'date',
    'link',
    'duration',
  );
  foreach ($elements as $element) {
    $files[$key][$element] = $options[$element] != SWFTOOLS_UNDEFINED && $work[$options[$element]] ? $work[$options[$element]] : '';
  }
}