php - Symfony3 - MISD Phone Number Bundle format -


is possible set format returned entity containing phone number property when using misd phone-number-bundle? example have property $phonenumber

when call $this->getphonenumber() returns string formatted:

country code: 1 national number: ########## country code source:
want in format (or similar):
1 (###) ###-####

the reason want change because in entity implementing __tostring() method , want string returned combination of 2 properties 1 being "nickname" , other being phone number in type of format or similar nickname - 1 (###) ###-#### purpose of display them in drop down form element setup in form type created.

phone number instance of libphonenumber\phonenumber. class has __tostring method, returns not formated debug information object's properties

i have formated phone number temlate option sonataadminbundle:

$listmapper     ->add('phonenumber', phonenumbertype::class, [         'template' => ':crud:phonenumber_list_field.html.twig'     ]); 

template :crud:phonenumber_list_field.html.twig contents:

{% extends 'sonataadminbundle:crud:base_list_field.html.twig' %}  {% block field %}     {% if object.phonenumber null %}         -     {% else %}         {{ object.phonenumber|phone_number_format(2) }}     {% endif %} {% endblock %} 

here argument 2 twig filter \libphonenumber\phonenumberformat::national


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -