First copy the "processForm"-function from the action.class.php in your cache-directory ( /cache/dev/modules/auto[Modulename]/actions/actions.class.php ) to your action.class.php and change the lines:
if ($request->hasParameter('_save_and_add'))
{
$this->getUser()->setFlash('notice', $notice.' You can add another one below.');
$this->redirect('@[Modulename]_new');
}
else
{
$this->getUser()->setFlash('notice', $notice);
$this->redirect(array('sf_route' => '[Modulename]_edit', 'sf_subject' => $[Modulename]));
}
to:
if ($request->hasParameter('_save_and_add'))
{
$this->getUser()->setFlash('notice', $notice.' You can add another one below.');
$this->redirect('@[Modulename]_new');
}
else if ($request->hasParameter('_save_and_list'))
{
$this->getUser()->setFlash('notice', $notice);
$this->redirect('@[Modulename]');
}
else
{
$this->getUser()->setFlash('notice', $notice);
$this->redirect(array('sf_route' => '[Modulename]_edit', 'sf_subject' => $[Modulename]));
}
Open the file /apps/[Appname]/modules/[Modulename]/lib/[Modulename]GeneratorHelper.class.php and add the function:
';
public function linkToSaveAndList($object, $params)
{
return '
}
In /apps/[Appname]/modules/[Modulename]/config/generator.yml:
...
config:
...
form:
actions:
save_and_list: ~
...
Now there is a new button "Save and list" at the bottom of the Edit-form that will redirect the user to the list after saving the form. Maybe it would be useful to change the generator-classes to auto generate this button for every module.