I've got a form in Symfony that uses the money field type with the currency set to GBP.
When I pass the form over to twig the form is rendered using:
{{ form_row(form.price) }}
This renders the following html:
£<input id="app_product_price" name="app_product[price]" required="required" class="form-control" value="9.95" type="text">
My aim is to try and get the currency symbol so I can use the bootstrap money field:
<form class="form-inline">
<div class="form-group">
<label class="sr-only" for="exampleInputAmount">Amount (in dollars)</label>
<div class="input-group">
<div class="input-group-addon">$</div>
<input type="text" class="form-control" id="exampleInputAmount" placeholder="Amount">
<div class="input-group-addon">.00</div>
</div>
</div>
<button type="submit" class="btn btn-primary">Transfer cash</button>
</form>
Obviously, there are some styling that I need to do. However, I've tried to get the currency symbol using the below but there doesn't seem to be any documentation that I can see to do this.
{{ form_label(form.price) }}
{{ form_widget(form.price) }}
Neither of these seem to work to get the currency and I have also had a look into using {{ form_widget(form.price.vars.currency) }}
which just shows errors.
Are there any known methods of extracting the currency symbol from the form field? Or will I need to go down the route of Twig Form Theming?