Skip to content

Commit

Permalink
fix: school accordion text not formatted (#719)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorbrink authored Oct 23, 2023
1 parent 8aeac8a commit a2cc7c9
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions library/Controller/ContentType/School/SchoolDataPreparer.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,21 +292,17 @@ private function appendViewAccordionData(): void
$information = $this->postMeta->information;

if (isset($information->how_we_work) && !empty($information->how_we_work)) {
$accordions[] = ['list' => [
[
'heading' => __('About the school', 'municipio'),
'content' => $information->about_us
]
]];
$accordions[] = ['list' => [$this->getAccordionListItem(
__('About the school', 'municipio'),
$information->about_us
)]];
}

if (isset($information->how_we_work) && !empty($information->how_we_work)) {
$accordions[] = ['list' => [
[
'heading' => __('How we work', 'municipio'),
'content' => $information->how_we_work
]
]];
$accordions[] = ['list' => [$this->getAccordionListItem(
__('How we work', 'municipio'),
$information->how_we_work
)]];
}

if (isset($information->optional) && !empty($information->optional)) {
Expand All @@ -316,18 +312,23 @@ private function appendViewAccordionData(): void
continue;
}

$accordions[] = ['list' => [
[
'heading' => $optional->heading ?? '',
'content' => $optional->content ?? ''
]
]];
$accordions[] = ['list' => [$this->getAccordionListItem(
$optional->heading,
$optional->content
)]];
}
}

$this->data['accordions'] = $accordions;
}

private function getAccordionListItem(?string $heading, ?string $text):array {
return [
'heading' => $heading ?? '',
'content' => wpautop($text ?? '')
];
}

private function appendViewVisitingData(): void
{
$visitingAddresses = $this->postMeta->visitingAddress;
Expand Down

0 comments on commit a2cc7c9

Please sign in to comment.