myTD
myTD

Reputation: 1469

Symfony - FOSUser Bundle Styling Form Elements

I am trying to add classes to style some of the form elements FOSUser Bundle uses... for example ;

I want to style {{ form_widget(form.plainPassword.first) }} in a twig that i use.

how do i add styling to this call?

Upvotes: 0

Views: 260

Answers (1)

julien rollin
julien rollin

Reputation: 1607

first, be sure to understand how to customize form elements

Next, as described in FosuserBundle documentation , you will need to create a bundle that extends FosuserBundle like that

namespace Acme\UserBundle;


use Symfony\Component\HttpKernel\Bundle\Bundle;

class AcmeUserBundle extends Bundle
{
    public function getParent()
    {
        return 'FOSUserBundle';
    }
}

FosuserBundle will now look into your resources

EDIT:

To update your form element class

{{ form_widget(form.plainPassword.first, { 'attr': {'class': 'myformclass'} }) }}

Hope this helped

Upvotes: 2

Related Questions