You are here

function mediafront_get_playlist_from_view in MediaFront 6

Same name and namespace in other branches
  1. 6.2 mediafront.module \mediafront_get_playlist_from_view()
  2. 7.2 mediafront.module \mediafront_get_playlist_from_view()
  3. 7 mediafront.module \mediafront_get_playlist_from_view()

Returns a playlist provided a view.

2 calls to mediafront_get_playlist_from_view()
mediafront_get_playlist in ./mediafront.module
Gets a playlist
theme_mediafront_player_view in ./mediafront.module
Implement the theme for a views media player.

File

./mediafront.module, line 382

Code

function mediafront_get_playlist_from_view($view, $args = null) {

  // Create our playlist array.
  $playlist = array();
  $playlist['nodes'] = array();
  $playlist['name'] = $view->name;
  $playlist['total_rows'] = $view->total_rows ? $view->total_rows : ($view->query->pager ? $view->query->pager
    ->get_total_items() : 0);

  // Iterate through our result and get our player nodes.
  foreach ($view->result as $node) {
    if ($node = mediafront_get_node($node->nid, $args)) {
      $playlist['nodes'][] = $node;
    }
  }

  // Return the playlist.
  return $playlist;
}