Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $imgages = $node->get('field_frontpage_header_image');
- $random = $imgs->get(rand(0, $imgages->count() - 1))->getValue();
- $img = File::load($random['target_id']);
- $variables['random_header_image'] = ImageStyle::load('frontpage_header')->buildUrl($img->getFileUri());
Add Comment
Please, Sign In to add comment