mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
parent
97460af76a
commit
5b66613d83
2 changed files with 35 additions and 6 deletions
|
|
@ -247,9 +247,20 @@ class Value
|
|||
return is_array($value) ? implode('-', $value) : $value;
|
||||
case 'tel_intl':
|
||||
case 'tel_intl_v2':
|
||||
$country_code = $value[0] ?? '';
|
||||
$phone_number = implode('-', array_slice((array)$value, 1));
|
||||
return $value ? "(+{$country_code}) {$phone_number}": '';
|
||||
if (is_array($value) && count($value))
|
||||
{
|
||||
$country_code = $value[0];
|
||||
$phone_number = array_slice((array)$value, 1);
|
||||
if (count($phone_number) && ctype_alpha(end($phone_number)))
|
||||
{
|
||||
array_pop($phone_number);
|
||||
}
|
||||
return sprintf('(+%d) %s', $country_code, implode('-', $phone_number));
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
case 'homepage':
|
||||
case 'url':
|
||||
$display = mb_strlen($value, 'UTF-8') > 60 ? mb_substr($value, 0, 40, 'UTF-8') . '...' . mb_substr($value, -10, 10, 'UTF-8') : $value;
|
||||
|
|
|
|||
|
|
@ -9,15 +9,32 @@
|
|||
$lang_type = Context::getLangType();
|
||||
$lang_sort = $lang_type === 'ko' ? Rhymix\Framework\i18n::SORT_NAME_KOREAN : Rhymix\Framework\i18n::SORT_NAME_ENGLISH;
|
||||
$countries = Rhymix\Framework\i18n::listCountries($lang_sort);
|
||||
$tempid = $definition->getNextTempID();
|
||||
if (is_array($value) && count($value) && ctype_alpha(end($value))) {
|
||||
$selected_iso_code = end($value);
|
||||
} else {
|
||||
$selected_iso_code = null;
|
||||
}
|
||||
@endphp
|
||||
<select name="{{ $input_name }}[]" class="select rx_ev_select rx_ev_select_country">
|
||||
<select name="{{ $input_name }}[]"
|
||||
id="{{ $tempid }}" class="select rx_ev_select rx_ev_select_country"
|
||||
onchange="jQuery('#{{ $tempid }}_iso_code').val(jQuery(this).find('option:selected').data('isoCode'))">
|
||||
<option value=""></option>
|
||||
@foreach ($countries as $country)
|
||||
@php
|
||||
$country_name = $lang_type === 'ko' ? $country->name_korean : $country->name_english;
|
||||
$is_selected = strval($value[0] ?? '') !== '' && $value[0] === $country->calling_code;
|
||||
if ($selected_iso_code) {
|
||||
$is_selected = $selected_iso_code === $country->iso_3166_1_alpha3;
|
||||
} else {
|
||||
$is_selected = strval($value[0] ?? '') !== '' && $value[0] === $country->calling_code;
|
||||
if ($is_selected) {
|
||||
$selected_iso_code = $country->iso_3166_1_alpha3;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
<option value="{{ $country->calling_code }}" @selected($is_selected)>{{ $country_name }} (+{{ $country->calling_code }})</option>
|
||||
<option value="{{ $country->calling_code }}" data-iso-code="{{ $country->iso_3166_1_alpha3 }}" @selected($is_selected)>
|
||||
{{ $country_name }} (+{{ $country->calling_code }})
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@if ($type === 'tel_intl')
|
||||
|
|
@ -27,4 +44,5 @@
|
|||
@else
|
||||
<input type="tel" name="{{ $input_name }}[]" value="{{ $value[1] }}" size="16" maxlength="16" class="rx_ev_tel_v2" style="{{ $definition->style }}"|if="$definition->style" />
|
||||
@endif
|
||||
<input type="hidden" name="{{ $input_name }}[]" id="{{ $tempid }}_iso_code" value="{{ $selected_iso_code }}" />
|
||||
@endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue