Options in this order: <APP> <MODULE> <OBJECT>
$ symfony doctrine:generate-admin backend post Post$ symfony propel:generate-admin backend comment Comment
generator:
class: sfPropelAdminGenerator
param:
model_class: Post
moduleName: null
actions_base_class: sfActions
singular: post
plural: post_list
i18n_catalogue: messages
theme: default
css: custom.css
credentials: []
non_verbose_templates: null
route_prefix: ''
fields:
author_id: { label: Post author }
list:
title: symfony blog posts
display: [title, author_id, category_id, published_on]
fields:
published_on:
type: Date
label: Published
date_format: 'dd/MM/yy'
is_real: true
layout: stacked
params: |
%%is_published%%<strong>%%=title%%</strong><br />
<em>by %%author%% in %%category%%
(%%published_on%%)</em><p>%%content_summary%%</p>
max_per_page: 2
edit:
title: Editing post "%%title%%"
display:
"Post": [title, category_id, content]
"Workflow": [author_id, is_published, created_on]
fields:
category_id: { params: disabled=true }
content:
params: rich=true tinymce_options=height:150
author_id:
params: size=5 include_custom=Choose an author
is_published: { credentials: [[admin, superdamin]] }
created_on: { type: Date, date_format: 'dd/MM' }
list:
## tabular layout
display: [=title, author_id, created_at]
## stacked layout
layout: stacked
display: [title, author_id, created_at]
params: |
<strong>%%=title%%</strong>
by %%author%% (issued on %%created_at%%)
Stacked layout uses display setting for the column headers (and sorting)
edit:
## ungrouped
display: [title, author_id, created_at]
## grouped
display:
"NONE": [id]
"Group1": [title, body]
"Group2": [created_at]
Groups with label "NONE" have no label
filters:
- title ## text filter, accepts * as wildcard
- author ## foreign_key filter, displays select
- created_at ## date filter from... to...
- is_admin ## boolean filter, yes/no/yes or no
max_per_page: 10 ## maximum number of records per page
sort: created_at ## sort column (ascending order by default) sort: [created_at, desc] ## desc sort order
list:
object_actions:
_edit: -
_delete: -
actions:
_create: -
edit:
actions:
_list: -
_save: -
_save_and_add: -
_delete: -
actions:
my_action:
label: Add a comment
action: addComment
icon: backend/addcomment.png
only_for: edit ## Restrict to edit or create
params: class=foobar confirm=Are you sure?
credentials: [[admin, superuser], owner]
generator:
class: sfPropelAdminGenerator
param:
model_class: Post
theme: mytheme ## custom theme
css: custom.css ## replaces default css
fields:
my_field:
label: ## Field label/header
help: ## Tooltip, displays when requested
type: ## for edit view only, see below
credentials: ## Classic AND/OR credentials array
params: ## html options, depending on the tag
fields:
author: { label: Author }
list:
fields:
author: { help: This is the author of the comment }
edit:
fields:
author: { label: Author of the comment }
fields:
my_field:
type:
plain ## No input
input_tag ## Default for text, numeric
textarea_tag ## Default for longvarchar
input_date_tag ## Default for date and timestamp
select_tag ## Default for foreign keys
## And for booleans
checkbox_tag
radiobutton_tag
admin_input_upload_tag
fields:
my_field:
params:
disabled: true
date_format: 'MM/dd/yy' ## For dates but "type" must be "Date"
include_blank: true ## For select tags
include_custom: Choose from the list
size: 45x5 ## For textareas
rich: true
tinymce_options: height:150
list:
display: [nb_comments]
fields:
nb_comments: { label: Number of comments }
public function getNbComments()
{
return count($this->getComments());
}
list:
display: [_post_link]
fields:
post_link: { label: Related Post, is_real: false }
<php echo link_to( $comment->getPost()->getTitle(), 'post/edit?id='.$comment->getPostId() ) ?>Partials gain automatic access to the current object $<object>.