image

Image Styles

Whenever Drupal needs to provide an image in specific dimenions, FE needs to provide an image style.

Create a file in /.tools/es/responsive_image and define the height and width of the image for each breakpoint. Afterwards run phab scaffold .tools/es/index.yml to create the image styles. They are getting created in /config/sync. Don't forget to commit them and let the BE devs know what the relevant file is.

To see the changes locally:

  1. the configurations generated above must be imported via:
    phab -cmbb drush cim
    
  2. image's cache has to be cleaned via (press 1 when you are prompted to):
    phab -cmbb drush 'image-flush --all'
    
  3. clean cache via:
    phab -cmbb drush cr
    

Troubleshooting:

If you get any php errors during running phab scaffold .tools/es/index.yml you might need to update the scaffolder via composer update factorial-io/phab-entity-scaffolder

Information

Folder
src/components/elements/image

Files

Schema
Mocks
Template
// src/components/elements/image/image.twig

{% if sources and sources is not empty %}
	<picture>
		{% for source in sources %}
			<source {% if source.type %} type="{{ source.type }}" {% endif %} {% if source.media %} media="{{ source.media }}" {% endif %} {% if source.width %} width="{{ source.width }}" {% endif %} {% if source.height %} height="{{ source.height }}" {% endif %} srcset="{{ source.srcset }}">
		{% endfor %}
		<img class="Image{% if rounded %} Image--rounded{% endif %}{% if classes %} {{ classes|join(' ') }}{% endif %}" src="{{ uri }}" alt="{{ alt }}" {% if alt == "" %} aria-hidden="true" {% endif %} {% if width %} width="{{ width }}" {% endif %} {% if height %} height="{{ height }}" {% endif %} {% if is_lazy %} loading="lazy" decoding="async" {% elseif is_priority %} fetchpriority="high" {% endif %}>
	</picture>
{% else %}
	<img class="Image{% if rounded %} Image--rounded{% endif %}{% if classes %} {{ classes|join(' ') }}{% endif %}" src="{{ uri }}" alt="{{ alt }}" {% if alt == "" %} aria-hidden="true" {% endif %} {% if width %} width="{{ width }}" {% endif %} {% if height %} height="{{ height }}" {% endif %} {% if is_lazy %} loading="lazy" decoding="async" {% elseif is_priority %} fetchpriority="high" {% endif %}>
{% endif %}

Error: schema is invalid: data/properties must be object

Variants

default
Open

default mock data

Raw
Resolved
src with lazy
Open

src with lazy mock data

Raw
Resolved
srcset with same ratio
Open

srcset with same ratio mock data

Raw
Resolved
srcset with different ratio
Open

srcset with different ratio mock data

Raw
Resolved
srcset with lazy loading
Open

srcset with lazy loading mock data

Raw
Resolved
Ad banner Half Page
Open

Ad banner Half Page mock data

Raw
Resolved
Ad banner 6x5
Open

Ad banner 6x5 mock data

Raw
Resolved
Hero Article Detail Image
Open

Hero Article Detail Image mock data

Raw
Resolved
Jobs Teaser
Open

Jobs Teaser mock data

Raw
Resolved
Related Articles Teaser
Open

Related Articles Teaser mock data

Raw
Resolved
Standard Teaser
Open

Standard Teaser mock data

Raw
Resolved
Author avatar
Open

Author avatar mock data

Raw
Resolved
Stellenmarkt Logo
Open
Stellenmarkt result logo sample
Open

Stellenmarkt result logo sample mock data

Raw
Resolved