-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #840 from City-of-Helsinki/UHF-10239
UHF-10239: Adds image gallery paragraph
- Loading branch information
Showing
69 changed files
with
1,214 additions
and
4 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
modules/hdbt_admin_tools/assets/images/paragraph--image-gallery.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
modules/hdbt_admin_tools/src/Plugin/Validation/Constraint/ImageGalleryConstraint.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Drupal\hdbt_admin_tools\Plugin\Validation\Constraint; | ||
|
||
use Symfony\Component\Validator\Constraint; | ||
|
||
/** | ||
* Checks that the image gallery has at least two items. | ||
* | ||
* @Constraint( | ||
* id = "ImageGallery", | ||
* label = @Translation("There should be at least two gallery items.", context = "Validation"), | ||
* type = "entity:paragraph" | ||
* ) | ||
*/ | ||
class ImageGalleryConstraint extends Constraint { | ||
|
||
/** | ||
* Message shown for the Image gallery paragraph. | ||
* | ||
* @var string | ||
*/ | ||
public string $galleryItemRequired = 'Image gallery paragraph should have at least two items.'; | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
...les/hdbt_admin_tools/src/Plugin/Validation/Constraint/ImageGalleryConstraintValidator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Drupal\hdbt_admin_tools\Plugin\Validation\Constraint; | ||
|
||
use Symfony\Component\Validator\Constraint; | ||
use Symfony\Component\Validator\ConstraintValidator; | ||
|
||
/** | ||
* Validates the Image Gallery constraint. | ||
*/ | ||
class ImageGalleryConstraintValidator extends ConstraintValidator { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function validate(mixed $value, Constraint $constraint): void { | ||
assert($constraint instanceof ImageGalleryConstraint); | ||
$parent = $value->getEntity(); | ||
|
||
if ($value->getName() !== 'field_gallery_item') { | ||
return; | ||
} | ||
|
||
if ( | ||
$parent && | ||
$parent->hasField('field_gallery_item') && | ||
$parent->get('field_gallery_item')->count() < 2 | ||
) { | ||
$this->context->addViolation($constraint->galleryItemRequired); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
modules/helfi_image_styles/config/install/image.style.0.7_1086w_1630h_LQ.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
uuid: 74ef3c22-d7ea-4cb1-8aab-01ba6b79bde5 | ||
langcode: en | ||
status: true | ||
dependencies: | ||
module: | ||
- focal_point | ||
- image_style_quality | ||
name: 0.7_1086w_1630h_LQ | ||
label: 0.7_1086w_1630h_LQ | ||
effects: | ||
1c1da0f4-bb6a-4f11-88eb-8cd33a8e0da2: | ||
uuid: 1c1da0f4-bb6a-4f11-88eb-8cd33a8e0da2 | ||
id: focal_point_scale_and_crop | ||
weight: 1 | ||
data: | ||
width: 1086 | ||
height: 1630 | ||
crop_type: focal_point | ||
c319bca0-92f7-4467-a5ec-1b902ce2be1b: | ||
uuid: c319bca0-92f7-4467-a5ec-1b902ce2be1b | ||
id: image_style_quality | ||
weight: 2 | ||
data: | ||
quality: 65 |
17 changes: 17 additions & 0 deletions
17
modules/helfi_image_styles/config/install/image.style.0.7_352w_572h.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
uuid: f0276d08-9181-4923-9b87-49e9bf5ee5f4 | ||
langcode: en | ||
status: true | ||
dependencies: | ||
module: | ||
- focal_point | ||
name: 0.7_352w_572h | ||
label: 0.7_352w_572h | ||
effects: | ||
11ff7a5b-af0b-4eac-a4a3-7bc3b9ac6188: | ||
uuid: 11ff7a5b-af0b-4eac-a4a3-7bc3b9ac6188 | ||
id: focal_point_scale_and_crop | ||
weight: 1 | ||
data: | ||
width: 352 | ||
height: 572 | ||
crop_type: focal_point |
17 changes: 17 additions & 0 deletions
17
modules/helfi_image_styles/config/install/image.style.0.7_414w_621h.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
uuid: 9ec716c1-6f6d-4d08-971f-a9d9230e43b7 | ||
langcode: en | ||
status: true | ||
dependencies: | ||
module: | ||
- focal_point | ||
name: 0.7_414w_621h | ||
label: 0.7_414w_621h | ||
effects: | ||
dc8a6ee8-839c-4972-9eb8-5df5305dc75d: | ||
uuid: dc8a6ee8-839c-4972-9eb8-5df5305dc75d | ||
id: focal_point_scale_and_crop | ||
weight: 1 | ||
data: | ||
width: 414 | ||
height: 621 | ||
crop_type: focal_point |
17 changes: 17 additions & 0 deletions
17
modules/helfi_image_styles/config/install/image.style.0.7_543w_815h.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
uuid: 6ff8a4a5-849c-4f94-8f22-1eb670793bdc | ||
langcode: en | ||
status: true | ||
dependencies: | ||
module: | ||
- focal_point | ||
name: 0.7_543w_815h | ||
label: 0.7_543w_815h | ||
effects: | ||
6535b34f-21c8-4005-8561-d1936245e319: | ||
uuid: 6535b34f-21c8-4005-8561-d1936245e319 | ||
id: focal_point_scale_and_crop | ||
weight: 1 | ||
data: | ||
width: 543 | ||
height: 815 | ||
crop_type: focal_point |
24 changes: 24 additions & 0 deletions
24
modules/helfi_image_styles/config/install/image.style.0.7_704w_1144h_LQ.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
uuid: 19aa2c22-c3e9-47cd-b767-9fca520ae4ba | ||
langcode: en | ||
status: true | ||
dependencies: | ||
module: | ||
- focal_point | ||
- image_style_quality | ||
name: 0.7_704w_1144h_LQ | ||
label: 0.7_704w_1144h_LQ | ||
effects: | ||
289822b3-1d38-43a4-a18e-0344b4ef9161: | ||
uuid: 289822b3-1d38-43a4-a18e-0344b4ef9161 | ||
id: focal_point_scale_and_crop | ||
weight: 1 | ||
data: | ||
width: 704 | ||
height: 1144 | ||
crop_type: focal_point | ||
c5118eb7-9ad5-4756-9515-d6358c38bd75: | ||
uuid: c5118eb7-9ad5-4756-9515-d6358c38bd75 | ||
id: image_style_quality | ||
weight: 2 | ||
data: | ||
quality: 65 |
24 changes: 24 additions & 0 deletions
24
modules/helfi_image_styles/config/install/image.style.0.7_828w_1242h_LQ.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
uuid: 5ebc2957-c7ca-4606-ba96-49486e6630e4 | ||
langcode: en | ||
status: true | ||
dependencies: | ||
module: | ||
- focal_point | ||
- image_style_quality | ||
name: 0.7_828w_1242h_LQ | ||
label: 0.7_828w_1242h_LQ | ||
effects: | ||
fb181588-37f9-4269-ae4e-7c93d76ffebe: | ||
uuid: fb181588-37f9-4269-ae4e-7c93d76ffebe | ||
id: focal_point_scale_and_crop | ||
weight: 1 | ||
data: | ||
width: 828 | ||
height: 1242 | ||
crop_type: focal_point | ||
a3284e2a-d636-4454-b7b6-3958d1db2b35: | ||
uuid: a3284e2a-d636-4454-b7b6-3958d1db2b35 | ||
id: image_style_quality | ||
weight: 2 | ||
data: | ||
quality: 65 |
24 changes: 24 additions & 0 deletions
24
modules/helfi_image_styles/config/install/image.style.1_1086w_1086h_LQ.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
uuid: 9f76056d-d05c-40e9-9455-9caf237c2229 | ||
langcode: en | ||
status: true | ||
dependencies: | ||
module: | ||
- focal_point | ||
- image_style_quality | ||
name: 1_1086w_1086h_LQ | ||
label: 1_1086w_1086h_LQ | ||
effects: | ||
3fe5b5a5-6dcd-4410-865d-22d39e20ae22: | ||
uuid: 3fe5b5a5-6dcd-4410-865d-22d39e20ae22 | ||
id: focal_point_scale_and_crop | ||
weight: 1 | ||
data: | ||
width: 1086 | ||
height: 1086 | ||
crop_type: focal_point | ||
348c0fc5-7317-49a8-9a52-934e77165825: | ||
uuid: 348c0fc5-7317-49a8-9a52-934e77165825 | ||
id: image_style_quality | ||
weight: 2 | ||
data: | ||
quality: 65 |
17 changes: 17 additions & 0 deletions
17
modules/helfi_image_styles/config/install/image.style.1_414w_414h.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
uuid: 0f96fcb7-856c-4d80-9a22-b1e88f44ca2b | ||
langcode: en | ||
status: true | ||
dependencies: | ||
module: | ||
- focal_point | ||
name: 1_414w_414h | ||
label: 1_414w_414h | ||
effects: | ||
9ef8198f-6739-4a26-b0d7-157e42648cc4: | ||
uuid: 9ef8198f-6739-4a26-b0d7-157e42648cc4 | ||
id: focal_point_scale_and_crop | ||
weight: 1 | ||
data: | ||
width: 414 | ||
height: 414 | ||
crop_type: focal_point |
17 changes: 17 additions & 0 deletions
17
modules/helfi_image_styles/config/install/image.style.1_543w_543h.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
uuid: ca8cb2c4-7e3c-4a4a-ae75-9520f628f369 | ||
langcode: en | ||
status: true | ||
dependencies: | ||
module: | ||
- focal_point | ||
name: 1_543w_543h | ||
label: 1_543w_543h | ||
effects: | ||
ed62a58f-6f7b-47ff-b8c9-3574fb9abeba: | ||
uuid: ed62a58f-6f7b-47ff-b8c9-3574fb9abeba | ||
id: focal_point_scale_and_crop | ||
weight: 1 | ||
data: | ||
width: 543 | ||
height: 543 | ||
crop_type: focal_point |
24 changes: 24 additions & 0 deletions
24
modules/helfi_image_styles/config/install/image.style.1_828w_828h_LQ.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
uuid: d0a56f46-9d91-47a8-9269-57fda40b75ed | ||
langcode: en | ||
status: true | ||
dependencies: | ||
module: | ||
- focal_point | ||
- image_style_quality | ||
name: 1_828w_828h_LQ | ||
label: 1_828w_828h_LQ | ||
effects: | ||
c4554106-234a-4d04-a6cf-c7ae4f8886dd: | ||
uuid: c4554106-234a-4d04-a6cf-c7ae4f8886dd | ||
id: focal_point_scale_and_crop | ||
weight: 1 | ||
data: | ||
width: 828 | ||
height: 828 | ||
crop_type: focal_point | ||
ee011418-cb33-48a5-af34-10bfac5b3e64: | ||
uuid: ee011418-cb33-48a5-af34-10bfac5b3e64 | ||
id: image_style_quality | ||
weight: 2 | ||
data: | ||
quality: 65 |
36 changes: 36 additions & 0 deletions
36
modules/helfi_image_styles/config/install/responsive_image.styles.image_gallery_1_1.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
uuid: c0fef26d-9cc5-4756-b247-5a9c3f7b4550 | ||
langcode: en | ||
status: true | ||
dependencies: | ||
config: | ||
- image.style.1_1086w_1086h_LQ | ||
- image.style.1_414w_414h | ||
- image.style.1_543w_543h | ||
- image.style.1_828w_828h_LQ | ||
module: | ||
- helfi_image_styles | ||
id: image_gallery_1_1 | ||
label: 'Image gallery 1:1' | ||
image_style_mappings: | ||
- | ||
image_mapping_type: image_style | ||
image_mapping: 1_414w_414h | ||
breakpoint_id: helfi_image_styles.m | ||
multiplier: 1x | ||
- | ||
image_mapping_type: image_style | ||
image_mapping: 1_828w_828h_LQ | ||
breakpoint_id: helfi_image_styles.m | ||
multiplier: 2x | ||
- | ||
image_mapping_type: image_style | ||
image_mapping: 1_543w_543h | ||
breakpoint_id: helfi_image_styles.xs | ||
multiplier: 1x | ||
- | ||
image_mapping_type: image_style | ||
image_mapping: 1_1086w_1086h_LQ | ||
breakpoint_id: helfi_image_styles.xs | ||
multiplier: 2x | ||
breakpoint_group: helfi_image_styles | ||
fallback_image_style: 1_414w_414h |
Oops, something went wrong.