function facebook_album_ajax_get_albums_next in Facebook Album 7.3
Same name and namespace in other branches
- 7.2 facebook_album.module \facebook_album_ajax_get_albums_next()
Fetch the next or previous set of cover photos from the specified page ID.
Parameters
$after: The id for fetching the next set of albums.
$delta: The block delta.
Return value
mixed A json object containing an html template and after id
1 call to facebook_album_ajax_get_albums_next()
- facebook_album_ajax_get_albums in ./
facebook_album.module - Fetch first set of albums specified in the settings menu.
1 string reference to 'facebook_album_ajax_get_albums_next'
- facebook_album_menu in ./
facebook_album.module - Implements menu_hook()
File
- ./
facebook_album.module, line 391
Code
function facebook_album_ajax_get_albums_next($after, $delta) {
$settings = facebook_album_get_settings($delta);
$limit = $settings['albumLimit'];
if ($limit < 1) {
$limit = NULL;
}
else {
// ensure that ID's can't be passed in to retrieve albums.
// if limit has been set to a non-zero number.
$after = NULL;
}
$url = _facebook_album_build_api_request($settings['pageID'] . '/albums', [
'access_token' => $settings['access_token'],
'after' => $after,
'limit' => $limit,
'fields' => 'location,description,name,cover_photo.fields(images)',
]);
$response = _facebook_album_fetch_api_response($url);
$module_response['data']['content'] = facebook_album_build_cover_template($settings, $response['data']);
if (isset($response['paging']) && isset($response['paging']['next']) && $limit == NULL) {
$module_response['data']['after'] = $response['paging']['cursors']['after'];
}
else {
$module_response['data']['after'] = NULL;
}
drupal_json_output($module_response);
}