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 a8ca2c3..c56739e 100644 Binary files a/languages/piazza-in-festa-it_IT.mo and b/languages/piazza-in-festa-it_IT.mo differ 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"