amazon-image.html.twig in Amazon Product Advertisement API 8.2
Renders a link to Amazon using the product's image.
Available variables:
- image_src: URL of the image.
- width: (optional) width of the image.
- height: (optional) height of the image.
- item: The full return value from the APA API call.
- size: One of small|medium|large.
- url: The URL of the Amazon product page with the associates tag.
File
templates/amazon-image.html.twigView source
- {#
- /**
- * @file
- * Renders a link to Amazon using the product's image.
- *
- * Available variables:
- * - image_src: URL of the image.
- * - width: (optional) width of the image.
- * - height: (optional) height of the image.
- * - item: The full return value from the APA API call.
- * - size: One of small|medium|large.
- * - url: The URL of the Amazon product page with the associates tag.
- */
- #}
- {% if width is not empty %}
- {% set attributes = attributes.setAttribute('width', width) %}
- {% endif %}
- {% if height is not empty %}
- {% set attributes = attributes.setAttribute('height', height) %}
- {% endif %}
- <a href="{{ url }}"><img{{ attributes.setAttribute('src', image_src) }} /></a>