function photos_preprocess_photos_album_view in Album Photos 8.4
Same name and namespace in other branches
- 8.5 photos.module \photos_preprocess_photos_album_view()
- 6.0.x photos.module \photos_preprocess_photos_album_view()
Implements hook_preprocess_HOOK().
File
- ./
photos.module, line 1202 - Implementation of photos.module.
Code
function photos_preprocess_photos_album_view(&$variables, $hook) {
// Set additional variables.
if ($variables['node']) {
$variables['node_type'] = $variables['node']
->getType();
$variables['node_title'] = $variables['node']
->getTitle();
$account = $variables['node']
->getOwner();
$account_link = [
'#theme' => 'username',
'#account' => $account,
];
$variables['author_name'] = \Drupal::service('renderer')
->render($account_link);
$variables['date'] = \Drupal::service('date.formatter')
->format($variables['node']
->getCreatedTime());
}
$variables['display_type'] = \Drupal::config('photos.settings')
->get('photos_album_display_type');
if ($variables['display_type'] == 'grid') {
$variables['#attached']['library'][] = 'photos/photos.album-grid';
$variables['grid_col_count'] = \Drupal::config('photos.settings')
->get('photos_album_column_count');
$variables['grid_col_width'] = 'width: ' . 100 / $variables['grid_col_count'] . '%;';
}
$variables['pager'] = $variables['album']['pager'];
}