You are here

public function Photos::photosSearch in Flickr API Integration 8

Return a list of photos matching some criteria.

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|bool Response from the flickr method flickr.photos.search. (https://www.flickr.com/services/api/flickr.photos.search.html)

File

src/Service/Photos.php, line 102

Class

Photos
Class Photos.

Namespace

Drupal\flickr_api\Service

Code

public function photosSearch($nsid, $page = 1, array $otherArgs = [], $cacheable = TRUE) {
  $args = [
    'page' => $page,
    'user_id' => $nsid,
  ];
  $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.photos.search', $args, $cacheable);
  if ($response) {
    return $response['photos'];
  }
  return FALSE;
}