3
votes

I'm trying to customize the forms of sfGuardUser module. After installing the sfGuardDoctrinePlugin, I followed the cascading-configuration convention of Symfony and created the following structure:

apps/backend/modules/sfGuardUser
apps/backend/modules/sfGuardUser/config
apps/backend/modules/sfGuardUser/config/generator.yml

Within the generator.yml file, I tried to override default plugin settings as suggested in this related question and this post in the official blog:

generator:
  class: sfDoctrineGenerator
  param:
    config:
      fields:
        first_name:
          label: Name
        last_name:
          label: Surname
        email_address:
          label: Email
        updated_at:
          label: Last update
          date_format: f
      list:
        title: People
        display: [=username, name, email_address, last_login]
        sort: [username, asc]
      filter:
        display: [username, first_name, last_name, email_address]
      edit:
        title: Edit "%%name%%"
      new:
        title: Add a new user
      form:
        display:
          "User":                   [first_name, last_name, email_address, username, password, password_again]
          "Permissions and groups": [is_active, is_super_admin, groups_list]

However the form still reflects the default settings. For instance, it's still displaying the permissions_list.

Moreover, if you try to unset the widgets by overriding the sfGuardUserAdminForm you realize that it does not work either.

How can I avoid that and force a real overriding? Am I missing something?

Thanks!

UPDATE 1 I have found a workaround, which is assigning a false value to the group, and then set a new group with the fields I wanted:

"User":  [first_name, last_name, email_address, username, password, password_again]
"Permissions and groups":  false
"Status and groups":  [is_active, is_super_admin, groups_list]

UPDATE 2 This is a documented bug, but it seems core developers are not dealing with it. The ticket included a patch for those who are experiencing this problem like me.

1

1 Answers

2
votes

Unfortunately, overriding convention doesn't work the way you would expect with plugins' generator.yml. The easiest way is to configure the plugin's generator.yml file, which is what I do.

You can also move (not copy) the plugin's generator.yml to your app/module. There's also one interesting solution at this thread here: http://oldforum.symfony-project.org/index.php/m/43279/