Compare commits

..

2 Commits

Author SHA1 Message Date
Nonimart
fc0fb25f60 FIX Handling more state possible values in switch case
All checks were successful
continuous-integration/drone/push Build is passing
2025-06-12 17:44:42 +02:00
Nonimart
dd3361682f FIX Optional Date with escape if in case no date 2025-06-12 17:44:01 +02:00
2 changed files with 15 additions and 15 deletions

View File

@ -138,19 +138,17 @@ function getAcfStateNameFromEnglish($localisation)
function getGenericStateNameFromAcfStateName($state) function getGenericStateNameFromAcfStateName($state)
{ {
if ($state === 'Bruxelles') { switch ($state) {
return 'brussels'; case 'Bruxelles':
} return 'brussels';
case 'Région flamande':
if ($state === 'Vlaams Gewest') { case 'Vlaams Gewest':
return 'flanders'; return 'flanders';
} case 'Région Wallonne':
return 'wallonia';
if ($state === 'Région Wallonne') { case 'all':
return 'wallonia'; default:
} return 'all';
if ($state === 'all') {
return 'all';
} }
}; };
@ -246,7 +244,7 @@ function getRelativeTimeFromTimestamp($timestamp)
function format_phone_number($phoneNumber) function format_phone_number($phoneNumber)
{ {
// Nettoyage du numéro : retirer espaces, tirets, points, etc. // Nettoyage du numéro : retirer espaces, tirets, points, etc.
if (!$phoneNumber) return;
$cleanedNumber = preg_replace('/\D+/', '', $phoneNumber); $cleanedNumber = preg_replace('/\D+/', '', $phoneNumber);
$phoneType = detectBelgianPhoneType($cleanedNumber); $phoneType = detectBelgianPhoneType($cleanedNumber);

View File

@ -167,7 +167,9 @@ $pageIcon = get_field('page_icon', get_queried_object_id()) ?? null;
<?php if ($city): ?> <?php if ($city): ?>
<p class="chantier__city"><?php echo $city ?></p> <p class="chantier__city"><?php echo $city ?></p>
<?php endif; ?> <?php endif; ?>
<time class="chantier__date"> <?php echo $date ?></time> <?php if ($date): ?>
<time class="chantier__date"> <?php echo $date ?></time>
<?php endif; ?>
</div> </div>
<p class="chantier__description"><?php echo $chantier_description ?></p> <p class="chantier__description"><?php echo $chantier_description ?></p>