I need to render an image from my custom block. So i have to return an renderable array of an image object from my block.
I have written code like this(snippet), and its working fine.
$logo_build = [ '#theme' => 'image', '#width' => $width, '#height' => $height, '#uri' => $uri, ]; $renderer = \Drupal::service('renderer'); $renderer->addCacheableDependency($logo_build, $file); return [ 'logo' => $logo_build, ];
but now, how to set '#cache' value here ?
If it return array like below then i can use '#cache'. But in the above code how to set '#cache' value ?
return array( '#cache' => , );