public function PhotosController::contentOverview in Album Photos 8.4
Returns an overview of recent albums and photos.
Return value
array A render array for the photos_default theme.
1 string reference to 'PhotosController::contentOverview'
File
- src/
Controller/ PhotosController.php, line 125
Class
- PhotosController
- View albums and recent images.
Namespace
Drupal\photos\ControllerCode
public function contentOverview() {
$account = $this
->currentUser();
$content = [];
if ($account
->id() && $account
->hasPermission('create photo')) {
$val = PhotosImage::blockView('user', 5, 'photos/image', $account
->id());
$content['user']['image'] = isset($val['content']) ? $val['content'] : '';
$val = $this
->albumViews('user', 5, 'photos/user/' . $account
->id() . '/album', $account
->id());
$content['user']['album'] = $val['content'] ? $val['content'] : '';
}
$content['site']['image'] = PhotosImage::blockView('latest', 5, 'photos/image');
$content['site']['album'] = $this
->albumViews('latest', 5, 'photos/album');
return [
'#theme' => 'photos_default',
'#content' => $content,
'#empty' => $this
->t('No photos available.'),
];
}