You are here

function media_unsplash_render_content in Media Unsplash 7

Generate content + pager.

Parameters

mixed $content: Content array.

Return value

string Return themed content + pager.

2 calls to media_unsplash_render_content()
media_unsplash_ajax in ./media_unsplash.pages.inc
Return search results as html. Use in ajax fetching.
media_unsplash_external_ajax_callback in ./media_unsplash.module
AJAX callback function for media_unsplash_external().

File

./media_unsplash.module, line 370
Provides definition for unsplash media integration.

Code

function media_unsplash_render_content($content) {
  $pager = '';
  if (is_array($content)) {
    $total = intval($content['total']);
    $_GET['q'] = 'unsplash/ajax';

    // Initialize pager and gets current page.
    $current_page = pager_default_initialize($total, 30);

    // Calls Drupal standard pager theme and set 10 page links on pager.
    $pager = array(
      '#theme' => 'pager',
      '#quantity' => 10,
    );
  }
  $output = theme('media_unsplash_list', array(
    'content' => $content,
    'pager' => $pager,
    'pager_wrapper' => 'unsplash-pager',
    'css_wrapper' => 'unsplash-output',
  ));
  return $output;
}