From fbae03e4f3c22e861ff65bece55875b45632ae00 Mon Sep 17 00:00:00 2001 From: Lorenzo Iovino Date: Fri, 4 Sep 2026 16:33:50 +0200 Subject: [PATCH] feat: il widget ha tre aspetti (elenco, schede con locandina, carosello) e i comuni si tagliano al limite del servizio --- blocks/eventi/block.json | 1 + blocks/eventi/index.js | 16 +++++++++++++++- includes/render.php | 16 +++++++++++++--- ...t_IT-56aefc5f6b9253f9c52d737716d1e4e8.json | 14 +++++++++++++- ...-piazza-in-festa-eventi-editor-script.json | 14 +++++++++++++- languages/piazza-in-festa-it_IT.mo | Bin 2597 -> 2744 bytes languages/piazza-in-festa-it_IT.po | 16 ++++++++++++++++ 7 files changed, 71 insertions(+), 6 deletions(-) diff --git a/blocks/eventi/block.json b/blocks/eventi/block.json index 09395a0..1a1a539 100644 --- a/blocks/eventi/block.json +++ b/blocks/eventi/block.json @@ -18,6 +18,7 @@ "regione": { "type": "string", "default": "" }, "categoria": { "type": "string", "default": "" }, "limite": { "type": "string", "default": "5" }, + "formato": { "type": "string", "default": "lista" }, "tema": { "type": "string", "default": "chiaro" }, "colore": { "type": "string", "default": "" }, "titolo": { "type": "string", "default": "" }, diff --git a/blocks/eventi/index.js b/blocks/eventi/index.js index cb83028..b053f7b 100644 --- a/blocks/eventi/index.js +++ b/blocks/eventi/index.js @@ -99,7 +99,21 @@ set({ categoria: v }); } }), - campo('limite', __('How many events', 'piazza-in-festa'), __('From 1 to 20.', 'piazza-in-festa')) + campo('limite', __('How many events', 'piazza-in-festa'), __('From 1 to 20.', 'piazza-in-festa')), + el(SelectControl, { + label: __('Layout', 'piazza-in-festa'), + value: a.formato, + options: [ + { label: __('List', 'piazza-in-festa'), value: 'lista' }, + { label: __('Cards', 'piazza-in-festa'), value: 'schede' }, + { label: __('Carousel', 'piazza-in-festa'), value: 'carosello' } + ], + __next40pxDefaultSize: true, + __nextHasNoMarginBottom: true, + onChange: function (v) { + set({ formato: v }); + } + }) ), el( PanelBody, diff --git a/includes/render.php b/includes/render.php index c6fc30f..c1cb3f4 100644 --- a/includes/render.php +++ b/includes/render.php @@ -20,6 +20,7 @@ function pinfesta_defaults() { 'regione' => '', 'categoria' => '', 'limite' => '5', + 'formato' => 'lista', 'tema' => 'chiaro', 'colore' => '', 'titolo' => '', @@ -55,8 +56,12 @@ function pinfesta_categorie() { /** * Cleans a comma separated list of town identifiers (the slug you see in the - * address of a town page, for instance "la-morra"). Twelve at most, which is - * what the service accepts. + * address of a town page, for instance "la-morra"). + * + * The hard limit is the service's, not ours: twelve towns on the free plan, + * fifty with a key. Here we only cut at the higher of the two, so a site with + * a key is not trimmed by the plugin; the extra towns are simply ignored by + * the service when the key is missing. * * @param string $raw Raw attribute value. * @return string Normalised list, empty when nothing survives. @@ -72,7 +77,7 @@ function pinfesta_clean_comuni( $raw ) { } } - return implode( ',', array_slice( array_unique( $out ), 0, 12 ) ); + return implode( ',', array_slice( array_unique( $out ), 0, 50 ) ); } /** @@ -102,6 +107,11 @@ function pinfesta_build_url( $args ) { $query['limite'] = min( $limite, 20 ); } + // Elenco, schede con la locandina, o carosello che scorre da solo. + if ( in_array( $args['formato'], array( 'schede', 'carosello' ), true ) ) { + $query['formato'] = $args['formato']; + } + if ( 'scuro' === $args['tema'] ) { $query['tema'] = 'scuro'; } diff --git a/languages/piazza-in-festa-it_IT-56aefc5f6b9253f9c52d737716d1e4e8.json b/languages/piazza-in-festa-it_IT-56aefc5f6b9253f9c52d737716d1e4e8.json index 737b114..16fd409 100644 --- a/languages/piazza-in-festa-it_IT-56aefc5f6b9253f9c52d737716d1e4e8.json +++ b/languages/piazza-in-festa-it_IT-56aefc5f6b9253f9c52d737716d1e4e8.json @@ -1,5 +1,5 @@ { - "translation-revision-date": "2026-09-04 12:00+0000", + "translation-revision-date": "2026-09-04 16:00+0000", "generator": "manuale (nessun build step)", "domain": "messages", "locale_data": { @@ -68,6 +68,18 @@ ], "Piazza in Festa: set at least one town or a region in the block settings.": [ "Piazza in Festa: indica almeno un comune o una regione nelle impostazioni del blocco." + ], + "Layout": [ + "Aspetto" + ], + "List": [ + "Elenco" + ], + "Cards": [ + "Schede" + ], + "Carousel": [ + "Carosello" ] } } diff --git a/languages/piazza-in-festa-it_IT-piazza-in-festa-eventi-editor-script.json b/languages/piazza-in-festa-it_IT-piazza-in-festa-eventi-editor-script.json index 737b114..16fd409 100644 --- a/languages/piazza-in-festa-it_IT-piazza-in-festa-eventi-editor-script.json +++ b/languages/piazza-in-festa-it_IT-piazza-in-festa-eventi-editor-script.json @@ -1,5 +1,5 @@ { - "translation-revision-date": "2026-09-04 12:00+0000", + "translation-revision-date": "2026-09-04 16:00+0000", "generator": "manuale (nessun build step)", "domain": "messages", "locale_data": { @@ -68,6 +68,18 @@ ], "Piazza in Festa: set at least one town or a region in the block settings.": [ "Piazza in Festa: indica almeno un comune o una regione nelle impostazioni del blocco." + ], + "Layout": [ + "Aspetto" + ], + "List": [ + "Elenco" + ], + "Cards": [ + "Schede" + ], + "Carousel": [ + "Carosello" ] } } diff --git a/languages/piazza-in-festa-it_IT.mo b/languages/piazza-in-festa-it_IT.mo index a8ca2c3f4d7a1843f96840860e7eda8a29498041..c56739e99b4c224fd18cb32c9a606ce772fff0b8 100644 GIT binary patch delta 834 zcmYk)KS/{~F~OJbtc#Q3MS{z(%I*g{2Vk%F5@CO!#Ygx9L#%I( zXf$%;1UbxK&r58g{|}>7B|=tp^b@2%h_A37OQ?iDqZ0b&xsGq?Z=>eDLd|!F)flC0 zm8@^tXgtRbREY*Lj%j49S;QnRqZZoo-1VOCp}zD0$M835-Xz&P#SL_yqx&4+=s8)G z8fd(yQG>In440598V9xDSA2qNNFm&6wWIcnLW}5E=_~I;?>`L9tGTqElJR2NJoZ{j z;6AkXNYaf2SN%_wS`p`L;p8LTGU}JGk=$tIs*16d+)6g1{)&HQA+3{1@D z7YcUHxwC!+CO+jCiq4_0)5;dg=e|B)-AHE2p0wRj49ex5SnxF1UzoLv#k_MJ>Gr5sG?E$ delta 693 zcmX}qJxBvV5QgFLaxqckPtL^OXaXu2v=NIGR#rh!5Wy;1rm##U*hCQQ1j8X%2tmYF zgn-xy0YO^}u~D!PL1L?oh3~hBLpINGd$%(?d)MjnRP`nBkBk^&WEg&%Ssq)cIP}cA zv4$&H#~%E|IR4-wMkBn7Mb!K<>b(-ia0|0o!CtIk&a7&uT#R$0iBWt-E%c5Z*uoNi z;U=yznZ!%fLQP!42b{+Yi*(^Cs=y6QVHx?^&Y!!OCco`-kz}_g*vA7G?NpC97+`|( zRY(?#m`5J93Z`)zJMjQ{#g1_r>!=RgVGbX062DQ;WvDJjew*MzJDI_CTtMBg;V>r2 z?&i_WV?p!SkN23sXH-ESNHbhjN))BKAxt3qv{8maT~Qu)K2mK}>$I3cNfm<()^x>a zA$==4W5ozVN!1bURvlDP3Ux)n$+;NdUxn#AQ(;8l&WLa5KZ5YhtAypqZ8+yoHA;RV Q5}w7L!oB!x<0|fXzXBsS(*OVf diff --git a/languages/piazza-in-festa-it_IT.po b/languages/piazza-in-festa-it_IT.po index 3cf082d..cc085f3 100644 --- a/languages/piazza-in-festa-it_IT.po +++ b/languages/piazza-in-festa-it_IT.po @@ -120,3 +120,19 @@ msgstr "Si adatta da sola appena carica." #: blocks/eventi/index.js msgid "Piazza in Festa: set at least one town or a region in the block settings." msgstr "Piazza in Festa: indica almeno un comune o una regione nelle impostazioni del blocco." + +#: blocks/eventi/index.js +msgid "Layout" +msgstr "Aspetto" + +#: blocks/eventi/index.js +msgid "List" +msgstr "Elenco" + +#: blocks/eventi/index.js +msgid "Cards" +msgstr "Schede" + +#: blocks/eventi/index.js +msgid "Carousel" +msgstr "Carosello"