Skip to content

Commit fa78212

Browse files
author
Daniel Morse
committed
fix: re-add support for 'imageAttributes' for backwards compatibility, but deprecate it
1 parent 9dd9f18 commit fa78212

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

packages/components/bolt-image/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ npm install @bolt/components-image
88

99
## Image sizes
1010

11+
**IMPORTANT: This method of adding classes to images is DEPRECATED.**
12+
1113
To specify image size (e.g `u-bolt-width-1/1`) pass the correct class like so:
1214

1315
```

packages/components/bolt-image/image.schema.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
title: Image
22
type: object
3+
not:
4+
required:
5+
- imageAttributes
36
anyOf:
47
- required:
58
- src
@@ -73,3 +76,7 @@ properties:
7376
enum:
7477
- true
7578
- false
79+
imageAttributes:
80+
title: DEPRECATED
81+
type: object
82+
description: A Drupal-style attributes object with extra attributes to append to this component.

packages/components/bolt-image/src/image.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
lazyload ? "js-lazyload" : ""
6363
] %}
6464

65-
{% set image_attributes = create_attribute(image_attributes | default({})).addClass(image_classes, lazyload_classes)
65+
{% set image_attributes = create_attribute(imageAttributes | default({})).addClass(image_classes, lazyload_classes)
6666
.setAttribute('alt', alt)
6767
.setAttribute( (lazyload ? "data-" : null) ~ "srcset", srcset ? srcset : null)
6868
.setAttribute( (lazyload ? "data-" : null) ~ "sizes", sizes)

0 commit comments

Comments
 (0)