Skip to content

Possibility to override the label in country widget#90

Open
mablae wants to merge 1 commit into
misd-service-development:masterfrom
mablae:patch-1
Open

Possibility to override the label in country widget#90
mablae wants to merge 1 commit into
misd-service-development:masterfrom
mablae:patch-1

Conversation

@mablae

@mablae mablae commented Apr 28, 2016

Copy link
Copy Markdown

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

xabbuh commented May 1, 2016

Copy link
Copy Markdown
Contributor

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

@mablae

mablae commented May 1, 2016

Copy link
Copy Markdown
Author

@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
Copy Markdown
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
Copy Markdown
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

thoroc commented Jun 26, 2016

Copy link
Copy Markdown

What happened with this PR? can it be merged?

@mablae

mablae commented Jun 27, 2016

Copy link
Copy Markdown
Author

@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

thoroc commented Jul 4, 2016

Copy link
Copy Markdown

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

@thewilkybarkid

Copy link
Copy Markdown
Contributor

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

@shakaran

Copy link
Copy Markdown
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
Copy Markdown
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

yellow1912 commented Nov 12, 2017

Copy link
Copy Markdown

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

@myfbone

myfbone commented Mar 10, 2019

Copy link
Copy Markdown

Smth new about this issue?

@mablae

mablae commented Mar 12, 2019

Copy link
Copy Markdown
Author

Maybe we should finally write the tests?

@jimiero

jimiero commented Apr 1, 2019

Copy link
Copy Markdown

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

@kironet

kironet commented Apr 5, 2019

Copy link
Copy Markdown

Any news?

Nek- pushed a commit to Nek-/phone-number-bundle that referenced this pull request Nov 12, 2021
@lyrixx lyrixx mentioned this pull request Apr 7, 2025
Closed
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.

10 participants