FIX enhance sanitization of chapter index titles and anchors by removing non-alphanumeric characters
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ded284d708
commit
f996cc3209
|
|
@ -196,8 +196,8 @@ function build_page_chapter_index($blocks)
|
||||||
if ($block['blockName'] == 'homegrade-content-blocks/content-heading' && isset($block['attrs']['title']) && isset($block['attrs']['headingLevel']) && $block['attrs']['headingLevel'] == "h2") {
|
if ($block['blockName'] == 'homegrade-content-blocks/content-heading' && isset($block['attrs']['title']) && isset($block['attrs']['headingLevel']) && $block['attrs']['headingLevel'] == "h2") {
|
||||||
array_push($chapterBlockIndex, [
|
array_push($chapterBlockIndex, [
|
||||||
'block-type' => $block['blockName'],
|
'block-type' => $block['blockName'],
|
||||||
'anchor' => "#" . strip_tags($block['attrs']['idName']),
|
'anchor' => "#" . preg_replace('/[^a-zA-Z0-9]/', '', strip_tags($block['attrs']['idName'])), // remove html tags all non-alphanumeric characters
|
||||||
'title' => strip_tags($block['attrs']['title']),
|
'title' => preg_replace('/[^a-zA-Z0-9\s]/', '', strip_tags($block['attrs']['title'])), // remove html tags all non-alphanumeric characters
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
if ($block['blockName'] == 'homegrade-content-blocks/chapitrage-thematique') {
|
if ($block['blockName'] == 'homegrade-content-blocks/chapitrage-thematique') {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user