public static function PhotosAlbum::orderValueChange in Album Photos 8.4
Same name and namespace in other branches
- 8.5 src/PhotosAlbum.php \Drupal\photos\PhotosAlbum::orderValueChange()
- 6.0.x src/PhotosAlbum.php \Drupal\photos\PhotosAlbum::orderValueChange()
Extends photos order value.
7 calls to PhotosAlbum::orderValueChange()
- PhotosAlbum::nodeView in src/
PhotosAlbum.php - Page and Teaser display settings.
- PhotosAlbum::orderValue in src/
PhotosAlbum.php - Query helper: sort order and limit.
- PhotosAlbumController::albumView in src/
Controller/ PhotosAlbumController.php - Returns an overview of recent albums and photos.
- PhotosAlbumTest::testOrderValueChange in tests/
src/ Unit/ PhotosAlbumTest.php - @covers ::orderValueChange @dataProvider orderValueChangeProvider
- PhotosImage::pager in src/
PhotosImage.php - Photos image view pager block.
File
- src/
PhotosAlbum.php, line 459
Class
- PhotosAlbum
- Create an album object.
Namespace
Drupal\photosCode
public static function orderValueChange($field, $sort) {
// @note timestamp is deprecated, but may exist
// if albums are migrated from a previous version.
$array = [
'weight' => 'p.wid',
'timestamp' => 'f.fid',
'created' => 'f.fid',
'comments' => 'p.comcount',
'visits' => 'p.count',
'filesize' => 'f.filesize',
];
$array1 = [
'desc' => 'desc',
'asc' => 'asc',
];
if (isset($array[$field]) && isset($array1[$sort])) {
return [
'column' => $array[$field],
'sort' => $array1[$sort],
];
}
else {
// Default if values not found.
return [
'column' => 'f.fid',
'sort' => 'desc',
];
}
}