Skip to content

Commit

Permalink
TMS-942: Fix phone number trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
eebbi committed Nov 30, 2023
1 parent 4aa6440 commit 8c878ea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]


TMS-942:
- TMS-942:
- Check / uncheck search filter checkboxes depending on choices
- Trim contact phone number in href
- Increase fly-out-nav z-index to prevent chatbot from overlapping elements
Expand Down
6 changes: 3 additions & 3 deletions lib/Formatters/ContactFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ public function map_keys( array $posts, array $field_keys, $default_image = null
} );

// Remove whitespaces from phone_number to use on the href
$fields['trimmed_number'] = array_map( function( $item ) {
return str_replace( ' ', '', $item['phone_number'] );
}, $fields['phone_repeater'] );
foreach( $fields['phone_repeater'] as $i => $single_phone ) {
$fields['phone_repeater'][$i]['trimmed_number'] = str_replace( ' ', '', $single_phone['phone_number'] );
}
}

return $fields;
Expand Down
2 changes: 1 addition & 1 deletion partials/shared/contact-item.dust
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<div>
<span>{phone_text|html}</span>
<div>
<a href="tel:{phone_number|html}"
<a href="tel:{?trimmed_number}{trimmed_number|html}{:else}{phone_number|html}{/trimmed_number}"
class="has-text-paragraph hyphenate">
{phone_number|html}
</a>
Expand Down

0 comments on commit 8c878ea

Please sign in to comment.