function facebook_album_ajax_get_albums_next in Facebook Album 7.2
Same name and namespace in other branches
- 7.3 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
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 198
Code
function facebook_album_ajax_get_albums_next($after) {
$settings = facebook_album_get_settings();
$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', array(
'access_token' => $settings['appToken'],
'after' => $after,
'limit' => $limit,
'fields' => 'location,description,name',
));
$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;
}
return drupal_json_output($module_response);
}