mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Templating
This commit is contained in:
parent
18c57d532c
commit
29308110ea
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Phonenumber;
|
||||
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
|
||||
final class Templating extends AbstractExtension
|
||||
{
|
||||
protected PhoneNumberHelperInterface $phonenumberHelper;
|
||||
|
||||
public function __construct(PhoneNumberHelperInterface $phonenumberHelper)
|
||||
{
|
||||
$this->phonenumberHelper = $phonenumberHelper;
|
||||
}
|
||||
|
||||
public function formatPhonenumber(string $phonenumber): string
|
||||
{
|
||||
return $this->phonenumberHelper->format($phonenumber);
|
||||
}
|
||||
|
||||
public function getFilters()
|
||||
{
|
||||
return [
|
||||
new TwigFilter('chill_format_phonenumber', [$this, 'formatPhonenumber']),
|
||||
];
|
||||
}
|
||||
}
|
@ -7,10 +7,6 @@ services:
|
||||
|
||||
Chill\MainBundle\Phonenumber\PhonenumberHelper: ~
|
||||
|
||||
Chill\MainBundle\Phonenumber\Templating:
|
||||
tags:
|
||||
- { name: twig.extension }
|
||||
|
||||
Chill\MainBundle\Validation\Validator\ValidPhonenumber:
|
||||
tags:
|
||||
- { name: validator.constraint_validator }
|
||||
|
@ -148,14 +148,14 @@
|
||||
{% endif %}
|
||||
<li>
|
||||
{% if person.mobilenumber %}
|
||||
<i class="fa fa-li fa-mobile"></i><a href="{{ 'tel:' ~ person.mobilenumber }}">
|
||||
{{ person.mobilenumber|chill_format_phonenumber }}
|
||||
<i class="fa fa-li fa-mobile"></i><a href="{{ 'tel:' ~ person.mobilenumber|phone_number_format('E164') }}">
|
||||
{{ person.mobilenumber|phone_number_format('NATIONAL') }}
|
||||
</a>
|
||||
{% else %}
|
||||
<i class="fa fa-li fa-phone"></i>
|
||||
{% if person.phonenumber %}
|
||||
<a href="{{ 'tel:' ~ person.phonenumber }}">
|
||||
{{ person.phonenumber|chill_format_phonenumber }}
|
||||
<a href="{{ 'tel:' ~ person.phonenumber|phone_number_format('E164') }}">
|
||||
{{ person.phonenumber|phone_number_format('NATIONAL') }}
|
||||
</a>
|
||||
{% else %}
|
||||
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
|
||||
|
@ -25,15 +25,15 @@
|
||||
{% if person.phonenumber %}
|
||||
<span class="phonenumber d-block d-sm-inline-block">
|
||||
<i class="fa fa-fw fa-phone"></i>
|
||||
<a href="{{ 'tel:' ~ person.phonenumber }}" class="phone mr-3" title="{{ 'Phonenumber'|trans }}">
|
||||
{{ person.phonenumber|chill_format_phonenumber }}</a>
|
||||
<a href="{{ 'tel:' ~ person.phonenumber|phone_number_format('E164') }}" class="phone mr-3" title="{{ 'Phonenumber'|trans }}">
|
||||
{{ person.phonenumber|phone_number_format('NATIONAL') }}</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if person.mobilenumber %}
|
||||
<span class="mobilenumber d-block d-sm-inline-block">
|
||||
<i class="fa fa-fw fa-mobile"></i>
|
||||
<a href="{{ 'tel:' ~ person.mobilenumber }}" class="phone mr-3" title="{{ 'Mobilenumber'|trans }}">
|
||||
{{ person.mobilenumber|chill_format_phonenumber }}</a>
|
||||
<a href="{{ 'tel:' ~ person.mobilenumber|phone_number_format('E164') }}" class="phone mr-3" title="{{ 'Mobilenumber'|trans }}">
|
||||
{{ person.mobilenumber|phone_number_format('NATIONAL') }}</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if person.email %}
|
||||
|
@ -62,12 +62,12 @@
|
||||
<ul>
|
||||
{% if person.phonenumber is not empty %}
|
||||
<li>
|
||||
<a href="tel:{{ person.phonenumber }}"><img src="{{ asset('build/images/mobile-alt-solid.svg') }}"> <pre>{{ person.phonenumber|chill_format_phonenumber }}</pre></a>
|
||||
<a href="tel:{{ person.phonenumber|phone_number_format('E164') }}"><img src="{{ asset('build/images/mobile-alt-solid.svg') }}"> <pre>{{ person.phonenumber|phone_number_format('NATIONAL') }}</pre></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if person.mobilenumber is not empty%}
|
||||
<li>
|
||||
<a href="tel:{{ person.mobilenumber }}"><img src="{{ asset('build/images/phone-alt-solid.svg') }}"> <pre>{{ person.mobilenumber|chill_format_phonenumber }}</pre></a>
|
||||
<a href="tel:{{ person.mobilenumber|phone_number_format('E164') }}"><img src="{{ asset('build/images/phone-alt-solid.svg') }}"> <pre>{{ person.mobilenumber|phone_number_format('NATIONAL') }}</pre></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
@ -232,14 +232,14 @@ This view should receive those arguments:
|
||||
{%- if chill_person.fields.phonenumber == 'visible' -%}
|
||||
<dl>
|
||||
<dt>{{ 'Phonenumber'|trans }} :</dt>
|
||||
<dd>{% if person.phonenumber is not empty %}<a href="tel:{{ person.phonenumber }}"><pre>{{ person.phonenumber|chill_format_phonenumber }}</pre></a>{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}{% endif %}</dd>
|
||||
<dd>{% if person.phonenumber is not empty %}<a href="tel:{{ person.phonenumber|phone_number_format('E164') }}"><pre>{{ person.phonenumber|phone_number_format('NATIONAL') }}</pre></a>{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}{% endif %}</dd>
|
||||
</dl>
|
||||
{% endif %}
|
||||
|
||||
{%- if chill_person.fields.mobilenumber == 'visible' -%}
|
||||
<dl>
|
||||
<dt>{{ 'Mobilenumber'|trans }} :</dt>
|
||||
<dd>{% if person.mobilenumber is not empty %}<a href="tel:{{ person.mobilenumber }}">{{ person.mobilenumber|chill_format_phonenumber }}</a>{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}{% endif %}</dd>
|
||||
<dd>{% if person.mobilenumber is not empty %}<a href="tel:{{ person.mobilenumber|phone_number_format('E164') }}">{{ person.mobilenumber|phone_number_format('NATIONAL') }}</a>{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}{% endif %}</dd>
|
||||
<p>{% if person.acceptSMS %}{{ 'Accept short text message'|trans }}{% endif %}</p>
|
||||
</dl>
|
||||
{% endif %}
|
||||
@ -250,7 +250,7 @@ This view should receive those arguments:
|
||||
<dt>{{ 'Others phone numbers'|trans }} :</dt>
|
||||
{% for el in person.otherPhoneNumbers %}
|
||||
{% if el.phonenumber is not empty %}
|
||||
<dd>{% if el.description is not empty %}{{ el.description }} : {% endif %}<a href="tel:{{ el.phonenumber }}">{{ el.phonenumber|chill_format_phonenumber }}</a></dd>
|
||||
<dd>{% if el.description is not empty %}{{ el.description }} : {% endif %}<a href="tel:{{ el.phonenumber|phone_number_format('E164') }}">{{ el.phonenumber|phone_number_format('NATIONAL') }}</a></dd>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
@ -111,7 +111,7 @@
|
||||
</li>
|
||||
<li><i class="fa fa-li fa-phone"></i>
|
||||
{% if thirdparty.telephone %}
|
||||
<a href="{{ 'tel:' ~ thirdparty.telephone }}">{{ thirdparty.telephone|chill_format_phonenumber }}</a>
|
||||
<a href="{{ 'tel:' ~ thirdparty.telephone|phone_number_format('E164') }}">{{ thirdparty.telephone|phone_number_format('NATIONAL') }}</a>
|
||||
{% else %}
|
||||
<span class="chill-no-data-statement">{{ 'thirdparty.No_phonenumber'|trans }}</span>
|
||||
{% endif %}
|
||||
@ -136,7 +136,7 @@
|
||||
</li>
|
||||
<li><i class="fa fa-li fa-phone"></i>
|
||||
{% if thirdparty.telephone %}
|
||||
<a href="{{ 'tel:' ~ thirdparty.telephone }}">{{ thirdparty.telephone|chill_format_phonenumber }}</a>
|
||||
<a href="{{ 'tel:' ~ thirdparty.telephone|phone_number_format('E164') }}">{{ thirdparty.telephone|phone_number_format('NATIONAL') }}</a>
|
||||
{% else %}
|
||||
<span class="chill-no-data-statement">{{ 'thirdparty.No_phonenumber'|trans }}</span>
|
||||
{% endif %}
|
||||
|
@ -69,8 +69,8 @@
|
||||
{% if thirdParty.telephone == null %}
|
||||
<span class="chill-no-data-statement">{{ 'No phone given'|trans }}</span>
|
||||
{% else %}
|
||||
<a href="{{ 'tel:' ~ thirdParty.telephone }}">
|
||||
{{ thirdParty.telephone|chill_print_or_message("thirdparty.No_phonenumber") }}
|
||||
<a href="{{ 'tel:' ~ thirdParty.telephone|phone_number_format('E164') }}">
|
||||
{{ thirdParty.telephone|phone_number_format('NATIONAL') }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
Loading…
x
Reference in New Issue
Block a user