I want to change this:
{{ Form::submit('Delete this User', array('class' => 'btn btn-warning')) }}
to something like this:
{{ Form::submit('<i class="glyphicon glyphicon-delete"></i>', array('class' => '')) }}
I know that the second option isn't correct, anyone knows how to write it in a correct way?
Step by step guide for the implementation: Step 1: Include Bootstrap and jQuery CDN into the <head> tag before all other stylesheets to load our CSS. Step 2: Add <div> tag in the HTML body with class container. Step 3: Now add any icon that you want using the below syntax, where the name is the name of glyphicon.
Bootstrap provides set of graphic icons, symbols and fonts called Glyphicons.
The Glyphicons are a set of symbols and icons to understand more effectively and easily in web projects. The Glyphicons are used for some texts, forms, buttons, navigation, and etc. The bootstrap has many Glphyicons but there has a standard format to display icons.
Use a <button>
of type submit, which adds more flexibility then a submit input:
{{Form::button('<i class="glyphicon glyphicon-delete"></i>', array('type' => 'submit', 'class' => ''))}}
To make it clear, this is the class method:
public function button($value = null, $options = array()) { if ( ! array_key_exists('type', $options) ) { $options['type'] = 'button'; } return '<button'.$this->html->attributes($options).'>'.$value.'</button>'; }
As you can see, $value
holds anything you put inside the <button>
tag, so placing the icon there should work - I use this with Fontawesome icons and it works fine, I personally tend to use those instead of Glyphicon but the principle remains the same.
By using Form::submit()
, instead, you create an <input type="submit"
which cannot accept html as content of the value
attribute, that's why your solution won't work.
This works for me
{{ Form::button('<span class="glyphicon glyphicon-remove"></span>', array('class'=>'btn btn-default', 'type'=>'submit')) }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With