protected function FacebookAlbumController::filterAlbums in Facebook Album 8
The Facebook API does not allow us to specify which albums to load or exclude so after loading the albums we'll simply filter for any albums we want to display
Parameters
$albums: An array of albums from the facebook API
array $album_ids: Album IDs used to determine a whitelist or blacklist of albums from
bool $include: A flag, that if true, includes all albums specified in $albumIDs, otherwise it excludes all albums in $albumIDs
Return value
array An array of filtered albums
1 call to FacebookAlbumController::filterAlbums()
- FacebookAlbumController::getAlbumsNext in src/
Controller/ FacebookAlbumController.php - Fetch the next or previous set of cover photos from the specified page ID
File
- src/
Controller/ FacebookAlbumController.php, line 195 - Contains \Drupal\facebook_album\Controller\FacebookAlbumController.
Class
- FacebookAlbumController
- Controller for Facebook Album.
Namespace
Drupal\facebook_album\ControllerCode
protected function filterAlbums($albums, $album_ids = [], $include = TRUE) {
if (isset($album_ids[0]) && ($album_ids[0] != '' || $album_ids[0] == 0)) {
$include = (bool) $include;
$albums = array_filter($albums, function ($album) use ($album_ids, $include) {
return $include === in_array($album['id'], $album_ids);
});
}
return $albums;
}