From 20f4b9fe73eebbc1208dfae826e1fb89402fa88e Mon Sep 17 00:00:00 2001 From: Antoine M Date: Wed, 8 Apr 2026 16:09:23 +0200 Subject: [PATCH] FEATURE Introducing the block --- .../random-collection-image/block.json | 28 +++++++++++++++++ .../random-collection-image.php | 30 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 plugins/dynamiques-blocks/acf-blocks/random-collection-image/block.json create mode 100644 plugins/dynamiques-blocks/acf-blocks/random-collection-image/random-collection-image.php diff --git a/plugins/dynamiques-blocks/acf-blocks/random-collection-image/block.json b/plugins/dynamiques-blocks/acf-blocks/random-collection-image/block.json new file mode 100644 index 0000000..52499ea --- /dev/null +++ b/plugins/dynamiques-blocks/acf-blocks/random-collection-image/block.json @@ -0,0 +1,28 @@ +{ + "name": "acf/random-collection-image", + "title": "Random Collection Image", + "category": "Image aléatoire de collection", + "multiple": false, + "icon": { + "foreground": "#136f63", + "src": "groups" + }, + "keywords": [ + "image", + "aléatoire", + "collection" + ], + "supports": { + "align": [ + "full", + "wide" + ] + }, + "acf": { + "mode": "auto", + "renderTemplate": "random-collection-image.php" + }, + "align": [ + "wide" + ] +} \ No newline at end of file diff --git a/plugins/dynamiques-blocks/acf-blocks/random-collection-image/random-collection-image.php b/plugins/dynamiques-blocks/acf-blocks/random-collection-image/random-collection-image.php new file mode 100644 index 0000000..5790a8c --- /dev/null +++ b/plugins/dynamiques-blocks/acf-blocks/random-collection-image/random-collection-image.php @@ -0,0 +1,30 @@ + 1.2: + $random_image_ratio_class = 'random-collection-image--landscape'; + break; + case $random_image_ratio < 0.8: + $random_image_ratio_class = 'random-collection-image--portrait'; + break; + default: + $random_image_ratio_class = 'random-collection-image--square'; + break; +} +?> +
+ <?php echo $random_image['alt']; ?> + +
+ +
+ +
\ No newline at end of file