Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to override the label in country widget #90

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mablae
Copy link

@mablae mablae commented Apr 28, 2016

By passing in a closure into the form options it's possible to customize the way the label of the country field is formatted:

image

By passing in a closure into the form options it's possible to customize the way the label of the country field is formatted:
@xabbuh
Copy link
Contributor

xabbuh commented May 1, 2016

Imo you should then also set the allowed types for this option to string and callable.

@mablae
Copy link
Author

mablae commented May 1, 2016

@xabbuh Thanks for your feedback. I wasn't even sure if this is the right way to do it?

I will check the required types thing you mentioned

$countryChoices[$options['country_widget_label']($countries, $name, $region)] = $region;
} else {
$countryChoices[sprintf('%s (+%s)', $name, $countries[$region])] = $region;
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xabbuh Is a default sprintf() call okay, in order to get rid off the else branch?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where would you place that sprintf() call?

@thoroc
Copy link

thoroc commented Jun 26, 2016

What happened with this PR? can it be merged?

@mablae
Copy link
Author

mablae commented Jun 27, 2016

@thoroc I forgot it to be honest. I will look into it tonight.

Thanks for the reminder

@thoroc thoroc mentioned this pull request Jun 28, 2016
@thoroc
Copy link

thoroc commented Jul 4, 2016

@mablae @xabbuh @thewilkybarkid any chances of merging this?

@thewilkybarkid
Copy link
Contributor

Sorry for the delay in looking at this. We'll need some test coverage before merging.

@shakaran
Copy link
Contributor

@xabbuh @thewilkybarkid BUMP Please check this issue for merge as soon is possible, it is a nice feature could customize the label or even the class (the test coverage should be pretty simple)

@shakaran
Copy link
Contributor

I just see to that the template https://github.com/misd-service-development/phone-number-bundle/blob/master/Resources/views/Form/tel_bootstrap.html.twig is not picket the default merge params in composed widget that should be useful.

For example in twig I have to hard customize as following via form.phone.country and via form.phone.number:

<div class="row-fluid inline" style="display:inline-block">
	<div class="inline 4u" style="display:inline-block">
	{{ form_widget(form.phone.country, {'attr' : { 'class' : 'control-label inline no-padding-right' } }) }}
	</div>
	
	<div class="inline 7u" style="display:inline-block">
	{{ form_widget(form.phone.number, {'attr' : { 'style': 'display:inline-block', 'class' : '10u col-sm-9 control-label inline no-padding-right' } }) }}
	</div>
</div>

@yellow1912
Copy link

yellow1912 commented Nov 12, 2017

Any update on this? Seem to have a conflict in the PhoneNumberType?

@myfbone
Copy link

myfbone commented Mar 10, 2019

Smth new about this issue?

@mablae
Copy link
Author

mablae commented Mar 12, 2019

Maybe we should finally write the tests?

@jimiero
Copy link

jimiero commented Apr 1, 2019

@mablae @xabbuh @thewilkybarkid any update with this? would be nice to have it merged

@kironet
Copy link

kironet commented Apr 5, 2019

Any news?

Nek- pushed a commit to Nek-/phone-number-bundle that referenced this pull request Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants