You are here

function facebook_album_ajax_get_photo_url in Facebook Album 7.3

Same name and namespace in other branches
  1. 7.2 facebook_album.module \facebook_album_ajax_get_photo_url()

Fetch an individual photo url from a Facebook album photo

Parameters

$id: The photo id.

$delta: The block delta.

Return value

json

1 string reference to 'facebook_album_ajax_get_photo_url'
facebook_album_menu in ./facebook_album.module
Implements menu_hook()

File

./facebook_album.module, line 437

Code

function facebook_album_ajax_get_photo_url($id, $delta) {
  $settings = facebook_album_get_settings($delta);
  $module_response = [
    'data' => NULL,
  ];
  $url = _facebook_album_build_api_request($id, [
    'access_token' => $settings['access_token'],
    'fields' => 'images,name',
  ]);
  $response = _facebook_album_fetch_api_response($url);
  if (!isset($response['error'])) {
    $module_response['data']['url'] = $response['images'][0]['source'];
    $module_response['data']['name'] = isset($response['name']) ? $response['name'] : '';
  }
  drupal_json_output($module_response);
}