You are here

public function Favorites::favoritesGetPublicList in Flickr API Integration 8

Returns a list of favorite public photos for the given user.

Parameters

string $nsid: NSID of the user whose photoset tags will be returned.

int $page: Page of results to return.

array $otherArgs: Other args.

bool $cacheable: Cacheable.

Return value

array Response from the flickr method flickr.favorites.getPublicList. (https://www.flickr.com/services/api/flickr.favorites.getPublicList.html)

File

src/Service/Favorites.php, line 46

Class

Favorites
Class Favorites.

Namespace

Drupal\flickr_api\Service

Code

public function favoritesGetPublicList($nsid, $page = 1, array $otherArgs = [], $cacheable = TRUE) {
  $args = [
    'user_id' => $nsid,
    'page' => $page,
  ];
  $args = array_merge($args, $otherArgs);

  // Set per_page to flickr_api module default if not specified in $args.
  if (!isset($args['per_page'])) {

    // TODO Expose pager as a setting.
    $args['per_page'] = 6;
  }
  $response = $this->client
    ->request('flickr.favorites.getPublicList', $args, $cacheable);
  if ($response) {
    return $response['photos'];
  }
  return FALSE;
}