You are here

function facebook_album_ajax_get_album_next in Facebook Album 7.2

Same name and namespace in other branches
  1. 7.3 facebook_album.module \facebook_album_ajax_get_album_next()

Fetch the next or previous set of photos from the specified album

Parameters

$id: The album id to fetch photos from

$after: The id for fetching the next or previous set of photos

Return value

mixed A json object containing html template

1 call to facebook_album_ajax_get_album_next()
facebook_album_ajax_get_album in ./facebook_album.module
Fetch the first set of photos from the specified album
1 string reference to 'facebook_album_ajax_get_album_next'
facebook_album_menu in ./facebook_album.module
Implements menu_hook()

File

./facebook_album.module, line 155

Code

function facebook_album_ajax_get_album_next($id, $after) {
  $settings = facebook_album_get_settings();
  $url = _facebook_album_build_api_request($id . '/photos', array(
    'access_token' => $settings['appToken'],
    'after' => $after,
    'fields' => 'url',
  ));
  $response = _facebook_album_fetch_api_response($url);
  $module_response['data']['content'] = facebook_album_build_photo_template($settings, $response['data']);
  $module_response['data']['photo_ids'] = $response['data'];
  if (isset($response['paging']) && isset($response['paging']['next'])) {
    $module_response['data']['after'] = $response['paging']['cursors']['after'];
  }
  return drupal_json_output($module_response);
}