1

I look for create custom field image widget with image styles for drupal 8.

I need something like that:

// Here for example with a "Large preset"
<div class="wrap1"> 
    <div class="item"><img src="1.jpg"></div>
    <div class="item"><img src="2.jpg"></div>
    <div class="item"><img src="3.jpg"></div>
</div>

// Here  same images but with a "Thumbnail preset" 
<div class="wrap2">  
    <div class="item"><img src="1.jpg"></div>
    <div class="item"><img src="2.jpg"></div>
    <div class="item"><img src="3.jpg"></div>
</div>

I read this https://www.drupal.org/node/2620966 but still don’t understand how to applicate it for my objective. P.S. I mean to make it in a custom module.

I don’t have any idea how to make it. I’ll very thankful for any help!

9
  • Is this for the node edit form? or when you view the node?
    – No Sssweat
    Jul 29, 2016 at 22:37
  • When i view the node
    – Mark Bg
    Jul 29, 2016 at 22:48
  • In that case, a non coding solution, would be to create a block view. Add the image field twice to your view field and style each of them differently. Then insert the block view to your node.
    – No Sssweat
    Jul 29, 2016 at 22:54
  • How about overriding the field template?
    – Jimmy Ko
    Jul 29, 2016 at 22:57
  • yes i thought about overriding the field template, but i cant found any example.
    – Mark Bg
    Jul 29, 2016 at 23:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.