I’m currently working on a custom module that adds a block to the layout structure.
I’m trying to render an image (icon) but the image it’s not getting loaded, i think the problem is that i’m confuse with the way #uri works in Drupal-8.x, could someone give me a hand? or if i’m doing something else wrong…
Everything is working except for the image…
RENDER ARRAY
$ block = array ( 'icon' => array ( '#prefix' => '<div class="container_sblock"><div class=' . $ icon . '>', '#suffix' => '</div>', '#theme' => 'image_style', '#style_name' => 'thumbnail', '#uri' => '/fussion/modules/Fussion_Modules/static_icontitle/ui/img/icono4.png', /*'#markup' => t('@icon', array('@icon' => $ icon,)),*/ ), 'title' => array ( '#prefix' => '<div class="title_sblock">', '#suffix' => '</div>', '#markup' => t('@title', array('@title' => $ title,)), ), 'description' => array ( '#prefix' => '<div class="overlay_sblock"><div class="text_sblock">', '#suffix' => '</div></div></div>', '#markup' => t('@descp', array('@descp' => $ descp,)) ), ); return $ block; }
When i look at the source code of the generated page i get this at the <img src="...">
:
<img src="/fussion/sites/default/files/styles/thumbnail/public//fussion/modules/Fussion_Modules/static_icontitle/ui/img/icono4.png?itok=PgJQ4pS6" alt="" typeof="foaf:Image" class="image-style-thumbnail" />
The idea is that the image will always be at /my_module/ui/img/
Thank you for your help!