From c60f9674b260d4acfd3d8879c741e17887addb02 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Mon, 6 May 2024 15:36:11 +0200 Subject: [PATCH] hadnling block no-answers & help-homegrade --- includes/utilities.php | 14 ++++++++++++++ resources/js/single-conseil.js | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/includes/utilities.php b/includes/utilities.php index 4eac814..b434f57 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -193,6 +193,20 @@ function build_page_chapter_index($blocks) 'title' => __("Vocabulaire", "homegrade-theme__texte-fonctionnel") . " " . get_the_terms(get_the_ID(), "thematiques")[0]->name, ]); } + if ($block['blockName'] == 'homegrade-content-blocks/help-homegrade') { + array_push($chapterBlockIndex, [ + 'block-type' => $block['blockName'], + 'anchor' => "#homegrade-vous-aide", + 'title' => __("Homegrade vous aide", "homegrade-blocks__texte-fonctionnel"), + ]); + } + if ($block['blockName'] == 'homegrade-content-blocks/no-answers') { + array_push($chapterBlockIndex, [ + 'block-type' => $block['blockName'], + 'anchor' => "#pas-de-reponses", + 'title' => __("Pas de réponse ?", "homegrade-blocks__texte-fonctionnel"), + ]); + } if ($block['blockName'] == 'homegrade-content-blocks/plus-loin') { array_push($chapterBlockIndex, [ 'block-type' => $block['blockName'], diff --git a/resources/js/single-conseil.js b/resources/js/single-conseil.js index 1c278cd..df8a937 100644 --- a/resources/js/single-conseil.js +++ b/resources/js/single-conseil.js @@ -62,10 +62,15 @@ export default function singleConseil() { const chapitresThematiques = document.querySelectorAll('.homegrade-blocks-chapitre-thematique'); const vocabulaireSummaryBlock = document.querySelector('.homegrade-blocks-vocabulaire-summary'); const plusLoinBlock = document.querySelector('#aller-plus-loin'); + const helpHomegradeBlock = document.querySelector('#homegrade-vous-aide'); + const noAnswers = document.querySelector('#pas-de-reponses'); + let allBlocks = []; if (vocabulaireSummaryBlock) allBlocks.push(vocabulaireSummaryBlock); if (plusLoinBlock) allBlocks.push(plusLoinBlock); + if (helpHomegradeBlock) allBlocks.push(helpHomegradeBlock); + if (noAnswers) allBlocks.push(noAnswers); if (questionsContainerBlocks.length > 0) allBlocks = [...allBlocks, ...questionsContainerBlocks]; if (chapitresThematiques.length > 0) allBlocks = [...allBlocks, ...chapitresThematiques];