Per action fieldset support by adding the get{$action}Fieldsets method
in the form:
class Person extends sfFormPropel
{
// ...
public function getNewFieldsets()
{
return array(
'NONE' => array('first_name', 'last_name'),
'Address' => array('street', 'number', 'city_id')
);
}
public function getEditFieldsets()
{
return $this->getNewFieldsets();
}
Only for New and Edit actions (show action is like a list view).
Per action layout support by adding the get{$action}Layout method in the
form:
class Person extends sfFormPropel
{
// ...
public function getNewLayout()
{
return 'tabbed'; // or 'folded'
}
public function getEditLayout()
{
return 'folded'; // or 'tabbed'
}
Also you can create another layouts, creating a partial. I.E., tabbed
layout is coded in _form_tabbed.php and _show_form_tabbed.php.
Fields and display configuration through the form for new, edit and show
contexts.
- The forms are displayed in tables rather than divs (as originally in forms)
and thus the partials are less than in the standard generator.
- Form formatters are used if defined.
Object actions can be forbidden if a method is defined in the object. IE:
class Person extends BasePerson
{
/**
* this method will be used to forbid the edit action in the generator
*/
public function canEdit($sf_user)
{
return !$this->getLock();
}
}
The method takes one argument: the user.
new action can be forbidden defining the canNew method on Peer class. IE:
class PersonPeer extends BasePersonPeer
{
/**
* this method will be used to forbid the new action in the generator
*/
public function canNew($sf_user)
{
// do something...
return true;
}
}
Object actions can be show on a condition. IE:
list:
object_actions:
_edit:
show_when: canEdit
# ...
External column sorting. Suppose that the model Person has a foreign key:
document_type_id, so we want to sort the list columns by document_type.
In this case need to do this:
list:
fields:
document_type:
peer_column: DocumentTypePeer::NAME
peer_method: doSelectJoinDocumentType
display: [first_name, last_name, document_type, document_number]
Multiple sorting
list:
multiple_sort: true
New flash messages
- 'error': same as before.
- 'error_params': this should be an array that will be used as a second parameter of the __() method. Use this for translation.
- 'error_detail': an array of messages to be displayed below the 'error' message.
'error_detail_params': like 'error_params' but for the 'error_detail' message.
'notice': same old story.
- 'notice_params': this should be an array that will be used as a second parameter of the __() method.
- 'notice_detail' an array of messages to be displayed below the 'notice' message. Use this for translation.
'notice_detail_params': like 'notice_params' but for the 'notice_detail' message.
'warning': same old story.
- 'warning_params': this should be an array that will be used as a second parameter of the __() method. Use this for translation.
- 'warning_detail': an array of messages to be displayed below the 'warning' message. Use this for translation.
- 'warning_detail_params': like 'warning_params' but for the 'warning_detail' message.
Top actions
If you want to display the form or list actions above the form or the list, you can set the 'use_top_actions' to true in the 'list' and 'form' section of the generator.yml
list:
use_top_actions: true
form:
use_top_actions: true
Top pagination
If you want to display the paginator above the list set the 'use_top_pagination' to true in the 'list' section.
list:
use_top_pagination: true
New partials
In each
element of the list, there's a partial that can be used to add clases to each row. The outputted code is something like:
<tr class="sf_admin_row <?php include_partial('sf_admin_row_extra_classes', array('object' => $object))">
...
</tr>
Show context as list context: display and layout are available. In this case,
layout acts as the layout in the new and edit context. IE, with tabbed layout,
the generator will render _show_form_tabbed.php partial.
Use it like this:
show:
title: Showing something
layout: tabbed
display:
First tab: [first_name, last_name]
Second tab: [_full_id]
As you can see, you can use partials.
A new form formatter, which adds the "required" class to required widgets' label. Usage:
public function configure()
{
$pm_formatter_table = new pmWidgetFormSchemaFormatterTable($this);
$this->getWidgetSchema()->addFormFormatter("pm_table", $pm_formatter_table);
$this->getWidgetSchema()->setFormFormatterName("pm_table");
}
Export to CSV or EXCEL (requires sfPhpExcelPlugin to work). See the EXPORTATION_DOCUMENTATION file for complete documentation.
Suggestions
Email me suggestions!