hadnling block no-answers & help-homegrade

This commit is contained in:
Antoine M 2024-05-06 15:36:11 +02:00
parent 050f7373b8
commit c60f9674b2
2 changed files with 19 additions and 0 deletions

View File

@ -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'],

View File

@ -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];