You are here

function photos_preprocess_photos_image_block in Album Photos 8.4

Same name and namespace in other branches
  1. 8.5 photos.module \photos_preprocess_photos_image_block()
  2. 6.0.x photos.module \photos_preprocess_photos_image_block()

Implements hook_preprocess_HOOK().

File

./photos.module, line 1372
Implementation of photos.module.

Code

function photos_preprocess_photos_image_block(&$variables) {

  // Prepare variables for photos_image_block.html.twig.
  $variables['created'] = \Drupal::service('date.formatter')
    ->format($variables['image']->created, 'short');
  $variables['user_url'] = Url::fromUri('base:photos/user/' . $variables['image']->uid . '/image')
    ->toString();
  $variables['album_url'] = Url::fromUri('base:photos/album/' . $variables['image']->nid)
    ->toString();
}