diff --git a/resources/lang/en/cw2020.php b/resources/lang/en/cw2020.php index 93787c8f7..bdb0959c0 100644 --- a/resources/lang/en/cw2020.php +++ b/resources/lang/en/cw2020.php @@ -163,6 +163,24 @@ 'Deep Dive massive open online course', 'Coding@Home series', ], + 'cards' => [ + 'community' => [ + 'href' => '', + 'new_tab' => '', + ], + 'activity' => [ + 'href' => '', + 'new_tab' => '', + ], + 'ambassadors' => [ + 'href' => '', + 'new_tab' => '', + ], + 'stories' => [ + 'href' => '', + 'new_tab' => '', + ], + ], ], ]; diff --git a/resources/views/static/get-involved.blade.php b/resources/views/static/get-involved.blade.php index fd752944f..c2119c06d 100644 --- a/resources/views/static/get-involved.blade.php +++ b/resources/views/static/get-involved.blade.php @@ -4,6 +4,44 @@ @section('description', 'Get started with EU Code Week: Run a coding activity, join a local event, or share your experience using #EUCodeWeek. No experience needed!') @php $list = [(object) ['label' => 'Get Involved', 'href' => '']]; + + $optionalValue = static function (string $key): ?string { + $value = __($key); + + if ($value === $key) { + return null; + } + + $value = trim($value); + + return $value !== '' ? $value : null; + }; + + $isTruthy = static function (?string $value): bool { + if ($value === null) { + return false; + } + + return in_array(strtolower($value), ['1', 'true', 'yes', 'on'], true); + }; + + $makeCardLink = static function (string $cardKey) use ($optionalValue, $isTruthy): array { + $href = $optionalValue("cw2020.get-involved.cards.{$cardKey}.href"); + $newTab = $isTruthy($optionalValue("cw2020.get-involved.cards.{$cardKey}.new_tab")); + + return [ + 'href' => $href, + 'target' => $href && $newTab ? '_blank' : null, + 'rel' => $href && $newTab ? 'noopener noreferrer' : null, + ]; + }; + + $engagementLinks = [ + 'community' => $makeCardLink('community'), + 'activity' => $makeCardLink('activity'), + 'ambassadors' => $makeCardLink('ambassadors'), + 'stories' => $makeCardLink('stories'), + ]; @endphp @section('layout.breadcrumb') @@ -111,7 +149,7 @@ class="text-dark-blue text-[22px] md:text-4xl leading-7 md:leading-[44px] font-m
-
+ -