From f19995471cba68969c6a481e2b833a12e69adc88 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Fri, 13 Feb 2026 15:32:16 +0100 Subject: [PATCH] FEATURES Handling block extra options --- .../src/dernieres-dynamiques/block.json | 10 +- .../src/dernieres-dynamiques/edit.js | 11 +- .../src/dernieres-dynamiques/render.php | 123 ++++++++++-------- 3 files changed, 85 insertions(+), 59 deletions(-) diff --git a/plugins/dynamiques-blocks/src/dernieres-dynamiques/block.json b/plugins/dynamiques-blocks/src/dernieres-dynamiques/block.json index bf8a79e..ab95d1e 100644 --- a/plugins/dynamiques-blocks/src/dernieres-dynamiques/block.json +++ b/plugins/dynamiques-blocks/src/dernieres-dynamiques/block.json @@ -9,7 +9,11 @@ "description": "Example block scaffolded with Create Block tool.", "example": {}, "supports": { - "html": false + "html": false, + "color": { + "background": true, + "text": true + } }, "textdomain": "dernieres-dynamiques", "editorScript": "file:./index.js", @@ -21,6 +25,10 @@ "displayType": { "type": "string", "default": "grid" + }, + "showTableOfContents": { + "type": "boolean", + "default": true } } } \ No newline at end of file diff --git a/plugins/dynamiques-blocks/src/dernieres-dynamiques/edit.js b/plugins/dynamiques-blocks/src/dernieres-dynamiques/edit.js index b120297..bc6c524 100644 --- a/plugins/dynamiques-blocks/src/dernieres-dynamiques/edit.js +++ b/plugins/dynamiques-blocks/src/dernieres-dynamiques/edit.js @@ -11,12 +11,16 @@ import "./editor.scss"; import ServerSideRender from "@wordpress/server-side-render"; export default function Edit({ attributes, setAttributes }) { - const { displayType } = attributes; + const { displayType, showTableOfContents = true } = attributes; function onDisplayTypeChange(value) { setAttributes({ displayType: value }); } + function onShowTableOfContentsChange(value) { + setAttributes({ showTableOfContents: !showTableOfContents }); + } + return ( <> @@ -31,6 +35,11 @@ export default function Edit({ attributes, setAttributes }) { +
diff --git a/plugins/dynamiques-blocks/src/dernieres-dynamiques/render.php b/plugins/dynamiques-blocks/src/dernieres-dynamiques/render.php index 69c4f55..22b4873 100644 --- a/plugins/dynamiques-blocks/src/dernieres-dynamiques/render.php +++ b/plugins/dynamiques-blocks/src/dernieres-dynamiques/render.php @@ -1,6 +1,13 @@ ID); ?> -
+
'block-dernieres-dynamiques content-section block-dernieres-dynamiques--' . $variantLocation . ' alignfull ' . $backgroundColorClass)); ?>>

@@ -84,80 +91,82 @@ $issue_related_articles = get_field('articles', $last_issue->ID);

-