I've installed the sfDoctrineGuard
plugin. Everything is working, I can use the /sf_guard_user/edit/:id page to edit a user.
I didn't like the way the permissions were listed as a select list, I wanted to display them as individual checkboxes split up based on the permission name. To do this I created a custom widget that extends sfWidgetFormChoice
. This is working the way I want it as well, but my problem is the following:
To use my custom widget, I edited the following lines in this file:
lib/form/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardUserForm.class.php
Before:
'groups_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardGroup')),
'permissions_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardPermission')),
After:
'groups_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardGroup', 'expanded' => true)),
'permissions_list' => new myCustomPermissionWidget(),
That gives the correct outcome.
The problem is that I shouldn't have edited the Base class as any time I build my model the file is overwritten.
So I should edit this file:
lib/form/doctrine/sfDoctrineGuardPlugin/sfGuardUserForm.class.php
class sfGuardUserForm extends PluginsfGuardUserForm
{
public function configure()
{
parent::configure();
$this->setWidgets(array(
'groups_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardGroup', 'expanded' => true)),
'permissions_list' => new myCustomPermissionWidget(),
));
}
}
But this does not work. I've tried the code inside a new function setup(), with parent::setup() before and after my code but still nothing.
PluginsfGuardUserForm is abstract and extends BasesfGuardUserForm but I don't see why that would stop it from working.
Any ideas?
Thanks