Skip to content

Commit

Permalink
feat: Only display CTA application on school page if displayOnWebsite… (
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna authored Nov 16, 2023
1 parent dff455f commit 4114fa1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 30 deletions.
7 changes: 6 additions & 1 deletion library/Controller/ContentType/School/SchoolDataPreparer.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,12 @@ private function appendViewApplicationData(): void
{
$this->data['application'] = [];

$this->data['application']['displayOnWebsite'] = (bool) $this->postMeta->ctaApplication->display_on_website;

$this->data['application']['displayOnWebsite'] = true;
if( false === $this->postMeta->ctaApplication->display_on_website || 0 === $this->postMeta->ctaApplication->display_on_website )
{
$this->data['application']['displayOnWebsite'] = false;
}

$this->data['application']['title'] = $this->postMeta->ctaApplication->title ?: sprintf(__('Do you want to apply to %s?', 'municipio'), get_queried_object()->post_title);
$this->data['application']['description'] = $this->postMeta->ctaApplication->description ?: '';
Expand Down
59 changes: 30 additions & 29 deletions views/v3/content-type-school.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,39 +85,40 @@
@endif


@paper(['classList' => ['u-color__bg--complementary-lighter', 'u-padding--4']])
@if ($application['displayOnWebsite'])

@typography(['element' => 'h2'])
{{ $application['title'] }}
@endtypography

@typography(['element' => 'p', 'classList' => ['u-margin__bottom--3']])
{{ $application['description'] }}
@endtypography
@paper(['classList' => ['u-color__bg--complementary-lighter', 'u-padding--4']])
@typography(['element' => 'h2'])
{{ $application['title'] }}
@endtypography

@if ($application['apply'])
@button([
'text' => $application['apply']['text'],
'href' => $application['apply']['url'],
'color' => 'primary',
'style' => 'filled',
'size' => 'lg',
])
@endbutton
@endif
@typography(['element' => 'p', 'classList' => ['u-margin__bottom--3']])
{{ $application['description'] }}
@endtypography

@if ($application['howToApply'])
@button([
'text' => $application['howToApply']['text'],
'href' => $application['howToApply']['url'],
'color' => 'secondary',
'style' => 'filled',
'size' => 'lg',
])
@endbutton
@endif
@if ($application['apply'])
@button([
'text' => $application['apply']['text'],
'href' => $application['apply']['url'],
'color' => 'primary',
'style' => 'filled',
'size' => 'lg',
])
@endbutton
@endif

@endpaper
@if ($application['howToApply'])
@button([
'text' => $application['howToApply']['text'],
'href' => $application['howToApply']['url'],
'color' => 'secondary',
'style' => 'filled',
'size' => 'lg',
])
@endbutton
@endif
@endpaper
@endif

@if ($contacts)

Expand Down

0 comments on commit 4114fa1

Please sign in to comment.