public static function PhotosAlbum::getCount in Album Photos 8.4
Same name and namespace in other branches
- 8.5 src/PhotosAlbum.php \Drupal\photos\PhotosAlbum::getCount()
- 6.0.x src/PhotosAlbum.php \Drupal\photos\PhotosAlbum::getCount()
Return number of albums or photos.
3 calls to PhotosAlbum::getCount()
- PhotosAlbum::userAlbumCount in src/
PhotosAlbum.php - Tracks number of albums created and number of albums allowed.
- PhotosImagesRecentController::contentOverview in src/
Controller/ PhotosImagesRecentController.php - Returns content for recent images.
- photos_user_load in ./
photos.module - Implements hook_ENTITY_TYPE_load().
File
- src/
PhotosAlbum.php, line 522
Class
- PhotosAlbum
- Create an album object.
Namespace
Drupal\photosCode
public static function getCount($type, $id = 0) {
$db = \Drupal::database();
switch ($type) {
case 'user_album':
case 'user_image':
case 'site_album':
case 'site_image':
case 'node_node':
return $db
->query("SELECT value FROM {photos_count} WHERE cid = :cid AND type = :type", [
':cid' => $id,
':type' => $type,
])
->fetchField();
case 'node_album':
return $db
->query("SELECT count FROM {photos_album} WHERE pid = :pid", [
':pid' => $id,
])
->fetchField();
}
}