I'am learning Drupal 8, and I would like create a custom module who create a block to add share button. The link of this button should be an image who stocked in my custom module. I would like use an image style on my picture.
Last but not least, i want use a render array.
In my build() method of my customblock.php i have whrite :
//create url link
$url = Url::fromUri('https://www.facebook.com/sharer/sharer.php?u='.$base_url.Url::fromRoute('<current>')->toString());
//create uri image
$pathmodule=drupal_get_path('module', 'share_configurable');
$urifacebook=$pathmodule.'/src/img/facebook.png';
//render array of link
if ($this->configuration['network']['facebook']=='facebook'){
$build['link_facebook'] = [
'#title' => [
'#theme' => 'image_style',
'#style_name' => 'thumbnail',
'#uri' => $urifacebook,
],
'#type' => 'link',
'#url' => $url
];
}
The link is create, but the image is not render... Can you help me please ?