handling chapitrage thematique in chapter index
This commit is contained in:
parent
40728d2945
commit
6e5cfd629c
|
|
@ -5,6 +5,19 @@ if (!function_exists('build_share_urls')) {
|
||||||
{
|
{
|
||||||
$chapterBlockIndex = [];
|
$chapterBlockIndex = [];
|
||||||
foreach ($blocks as $key => $block) {
|
foreach ($blocks as $key => $block) {
|
||||||
|
if ($block['blockName'] == 'homegrade-content-blocks/chapitrage-thematique') {
|
||||||
|
foreach ($block['innerBlocks'] as $key => $innerBlock) {
|
||||||
|
if (!$innerBlock['attrs']['chapterTitle']) continue;
|
||||||
|
|
||||||
|
$cleanedTitle = strtolower(preg_replace("/[^a-zA-Z]/", "", $innerBlock['attrs']['chapterTitle']));
|
||||||
|
|
||||||
|
array_push($chapterBlockIndex, [
|
||||||
|
'block-type' => $block['blockName'],
|
||||||
|
'anchor' => '#' . $cleanedTitle,
|
||||||
|
'title' => $innerBlock['attrs']['chapterTitle'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($block['blockName'] == 'homegrade-content-blocks/questions-container') {
|
if ($block['blockName'] == 'homegrade-content-blocks/questions-container') {
|
||||||
array_push($chapterBlockIndex, [
|
array_push($chapterBlockIndex, [
|
||||||
'block-type' => $block['blockName'],
|
'block-type' => $block['blockName'],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user