Added button twig function by bigfoot90 · Pull Request #383 · braincrafted/bootstrap-bundle
The function
Will render to
<button class="btn btn-default btn-md" type="submit"></button>
The function
Will render to
<a href="#" class="btn btn-default btn-md"></a>
You can also customize the buttons with options.
{{ button({
'id': 'test_button',
'label': 'Test',
'tooltip': 'Test',
'class': 'my-class',
'icon': 'check',
'type': 'sucess',
'size': 'sm',
'submit': false,
'attr': {
'data-confirm': 'Are you sure?'
},
}) }}Will render to
<button id="test_button" class="btn btn-sucess btn-sm my-class" type="button" title="Test" data-confirm="Are you sure?"><i class="fa fa-check"></i> Test</button>
The function
{{ button_link({
'label': 'Test',
'icon': 'check',
'type': 'sucess',
'size': 'sm',
'attr': {
'id': 'test_button',
'class': 'my-class',
'href': 'example.com',
'data-confirm': 'Are you sure?',
'title': 'Test',
},
}) }}Will render to
<a id="test_button" href="example.com" class="btn btn-sucess btn-sm my-class" title="Test" data-confirm="Are you sure?"><i class="fa fa-check"></i> Test</a>