You are here

function swftools_playlist_from_upload in SWF Tools 5

upload.module helper

User-friendly function to convert the files attached to a node into a structured $playlist_data array ready to pass to swf_list().

Parameters

$nid: Pass a specific nid, otherwise the function automatically assumes the page is a node display page, and the nid from ?=node/nid.

File

./swftools_integrate.module, line 52

Code

function swftools_playlist_from_upload($node = SWFDEFAULT, $type_filter = array(), $only_listed = TRUE) {
  if (!isset($node->nid)) {
    if (!$node) {
      $nid = arg(1);
    }
    else {
      $nid = $node;
    }
    $node = node_load(array(
      'nid' => $nid,
    ));
  }
  $files = $node->files;

  // Remove any files that are not "listed"
  if ($only_listed) {
    foreach ($files as $fid => $details) {
      if ($details->list == FALSE) {
        unset($files[$fid]);
      }
    }
  }
  $playlist_data = swftools_prepare_playlist_data($files, $node->title, TRUE, $type_filter);
  return $playlist_data;
}