Skip to content

Commit 6aa4f73

Browse files
committed
[#1218] Format all phone numbers, not just 402-472 ones
1 parent 4e89aec commit 6aa4f73

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

web/themes/custom/unl_six_herbie/templates/node/node--person--full.html.twig

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,16 @@
143143
{% endif %}
144144
</a>
145145
{% else %}
146-
<a class="dcf-txt-decor-hover" href="tel:{{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|replace({' ':''}) }}" itemprop="telephone">
147-
<span class="dcf-txt-nowrap">{{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|replace({ '402472': '402-472-' }) }}</span>
146+
<a class="dcf-txt-decor-hover" href="tel:{{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|replace({' ':''}) }}" itemprop="telephone">
147+
<span class="dcf-txt-nowrap">
148+
{% if node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|replace({' ':''})|length == 10 %}
149+
{{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|slice(0,3) ~ '-' ~
150+
node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|slice(3,3) ~ '-' ~
151+
node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|slice(6,4) }}
152+
{% else %}
153+
{{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value }}
154+
{% endif %}
155+
</span>
148156
{% if (node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|slice(0, 6)) == '402472' %}
149157
<small class="on-campus-dialing dcf-txt-xs dcf-txt-nowrap" title="For on-campus dialing only. Off-campus, dial {{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|replace({ '402472': '402-472-' }) }}">On-campus
150158
{{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|replace({ '402472': '2-' }) }}

web/themes/custom/unl_six_herbie/templates/node/node--person--teaser-centered.html.twig

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,16 @@
9494
{% endif %}
9595
</a>
9696
{% else %}
97-
<a class="dcf-txt-decor-hover" href="tel:{{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|replace({' ':''}) }}" itemprop="telephone">
98-
<span class="dcf-txt-nowrap">{{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|replace({ '402472': '402-472-' }) }}</span>
97+
<a class="dcf-txt-decor-hover" href="tel:{{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|replace({' ':''}) }}" itemprop="telephone">
98+
<span class="dcf-txt-nowrap">
99+
{% if node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|replace({' ':''})|length == 10 %}
100+
{{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|slice(0,3) ~ '-' ~
101+
node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|slice(3,3) ~ '-' ~
102+
node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|slice(6,4) }}
103+
{% else %}
104+
{{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value }}
105+
{% endif %}
106+
</span>
99107
{% if (node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|slice(0, 6)) == '402472' %}
100108
<small class="on-campus-dialing dcf-txt-xs dcf-txt-nowrap" title="For on-campus dialing only. Off-campus, dial {{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|replace({ '402472': '402-472-' }) }}">On-campus
101109
{{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|replace({ '402472': '2-' }) }}

web/themes/custom/unl_six_herbie/templates/node/node--person--teaser.html.twig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,13 @@
160160
{% else %}
161161
<a class="dcf-txt-decor-hover" href="tel:{{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|replace({' ':''}) }}" itemprop="telephone">
162162
<span class="dcf-txt-nowrap">
163-
{{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|replace({ '402472': '402-472-' }) }}
163+
{% if node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|replace({' ':''})|length == 10 %}
164+
{{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|slice(0,3) ~ '-' ~
165+
node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|slice(3,3) ~ '-' ~
166+
node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|slice(6,4) }}
167+
{% else %}
168+
{{ node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value }}
169+
{% endif %}
164170
</span>
165171

166172
{% if (node.n_person_unldirectoryreference.entity.ee_unldir_telephonenumber.value|slice(0, 6)) == '402472' %}

0 commit comments

Comments
 (0)