You are here

function facebook_album_ajax_get_album_next in Facebook Album 7.3

Same name and namespace in other branches
  1. 7.2 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

$delta: The Block delta for loading settings.

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 344

Code

function facebook_album_ajax_get_album_next($id, $after, $delta) {
  $settings = facebook_album_get_settings($delta);
  $url = _facebook_album_build_api_request($id . '/photos', [
    'access_token' => $settings['access_token'],
    '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'];
  }
  drupal_json_output($module_response);
}