public static function PhotosAlbum::orderValueChange in Album Photos 6.0.x
Same name and namespace in other branches
- 8.5 src/PhotosAlbum.php \Drupal\photos\PhotosAlbum::orderValueChange()
- 8.4 src/PhotosAlbum.php \Drupal\photos\PhotosAlbum::orderValueChange()
Extends photos order value.
6 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::getPager in src/
Entity/ PhotosImage.php - Gets the page for this image.
File
- src/
PhotosAlbum.php, line 462
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.weight',
'title' => 'p.title',
'timestamp' => 'p.id',
'changed' => 'p.changed',
'created' => 'p.created',
'comments' => 'c.comment_count',
'visits' => 'v.value',
'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' => 'p.id',
'sort' => 'desc',
];
}
}