Skip to content
This repository was archived by the owner on Feb 16, 2021. It is now read-only.

Conversation

@carakas
Copy link
Contributor

@carakas carakas commented Jan 6, 2016

At the moment, for example in the FrameworkUserBundle icons are added by setting the icon classes to the buttons
This changes the font of the button to the icon font making it not match the rest of the application
By extending this button it is now possible to add an icon to that button

In the template:

{{ form_widget(form.example, {
    'icon': 'fa fa-bug',
    'label': 'Bug',
    'attr':{'class': 'btn btn-large btn-default btn-block' }
}) }}

Or in the controller

    $builder
        ->add('example', SubmitType::class, [
                'label' => 'Bug',
                'icon' => 'fa fa-bug',
                'attr' => [
                    'class' => 'btn btn-large btn-default btn-block',
                ],
            ]
        );

Copy link
Contributor

Choose a reason for hiding this comment

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

da werkt enkel in PHP5.5 en hoger

Copy link
Contributor

Choose a reason for hiding this comment

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

we zetten trouwens ook nooit onze comments achter onze lijn, maar er boven. (maar ik zou het hier eigenlijk in de docblock van de method zetten)

Copy link
Contributor

Choose a reason for hiding this comment

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

@carakas vergeet ge die laatste comment niet te fixen?

@WouterSioen
Copy link
Contributor

looks good to me. Eventueel wel in het framework bundle hier een voorbeeld van toevoegen? (of toch tenminste een issue ervoor aanmaken dat dat ergens in de toekomst kan gedaan worden)

At the moment, for example in the FrameworkUserBundle icons are added by setting the icon classes to the buttons
This changes the font of the button to the icon font making it not match the rest of the application
By extending this button it is now possible to add an icon to that button

In the template:
{{ form_widget(form.example, {
    'icon': 'fa fa-bug',
    'label': 'Bug',
    'attr':{'class': 'btn btn-large btn-default btn-block' }
}) }}

Or in the controller
    $builder
        ->add('example', SubmitType::class, [
                'label' => 'Bug',
                'icon' => 'fa fa-bug',
                'attr' => [
                    'class' => 'btn btn-large btn-default btn-block',
                ],
            ]
        );
@tijsverkoyen
Copy link
Member

:shipit:

WouterSioen added a commit that referenced this pull request Jan 6, 2016
Add option to set an icon on a button
@WouterSioen WouterSioen merged commit a9fbe38 into master Jan 6, 2016
@WouterSioen WouterSioen deleted the button-icons branch January 19, 2016 10:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants