handling h2 in capter tabIndex
This commit is contained in:
parent
321ee5e28f
commit
827309f064
|
|
@ -189,6 +189,14 @@ function build_page_chapter_index($blocks)
|
|||
{
|
||||
$chapterBlockIndex = [];
|
||||
foreach ($blocks as $key => $block) {
|
||||
|
||||
if ($block['blockName'] == 'homegrade-content-blocks/content-heading' && isset($block['attrs']['title']) && isset($block['attrs']['headingLevel']) && $block['attrs']['headingLevel'] == "h2") {
|
||||
array_push($chapterBlockIndex, [
|
||||
'block-type' => $block['blockName'],
|
||||
'anchor' => "#" . $block['attrs']['idName'],
|
||||
'title' => $block['attrs']['title'],
|
||||
]);
|
||||
}
|
||||
if ($block['blockName'] == 'homegrade-content-blocks/chapitrage-thematique') {
|
||||
foreach ($block['innerBlocks'] as $key => $innerBlock) {
|
||||
if (!$innerBlock['attrs']['chapterTitle']) continue;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user