protected function FacebookAlbumController::makeRequest in Facebook Album 8
Makes and Caches responses to limit FB API traffic
Parameters
$path:
array $parameters:
Return value
mixed
3 calls to FacebookAlbumController::makeRequest()
- FacebookAlbumController::getAlbumNext in src/
Controller/ FacebookAlbumController.php - Fetch the next or previous set of photos from the specified album
- FacebookAlbumController::getAlbumsNext in src/
Controller/ FacebookAlbumController.php - Fetch the next or previous set of cover photos from the specified page ID
- FacebookAlbumController::getPhoto in src/
Controller/ FacebookAlbumController.php - Fetch an individual photo url from a Facebook album photo
File
- src/
Controller/ FacebookAlbumController.php, line 213 - Contains \Drupal\facebook_album\Controller\FacebookAlbumController.
Class
- FacebookAlbumController
- Controller for Facebook Album.
Namespace
Drupal\facebook_album\ControllerCode
protected function makeRequest($path, $parameters = []) {
// For consistency
$cid = 'fba:' . str_replace("/", ":", $path);
// Append params except non-data changers
foreach ($parameters as $key => $parameter) {
if ($key != 'fields' && !empty($parameter)) {
$cid .= ':' . $parameter;
}
}
// Check cache first before calling API
if ($cache = \Drupal::cache()
->get($cid)) {
$response = $cache->data;
}
else {
$response = $this->facebook_album
->get($path, $parameters);
if (!isset($response['error'])) {
\Drupal::cache()
->set($cid, $response);
}
}
return $response;
}