Options in this order: <APP> <MODULE> <OBJECT>
$ symfony propel-init-admin backend post Post$ symfony propel-init-admin backend comment Comment
generator:
class: sfPropelAdminGenerator
param:
model_class: Post
theme: default
fields:
author_id: { name: Post author }
list:
title: symfony blog posts
display: [title, author_id, category_id]
fields:
published_on: { params: date_format='dd/MM/yy' }
layout: stacked
params: |
%%is_published%%<strong>%%=title%%</strong><br />
<em>by %%author%% in %%category%%
(%%published_on%%)</em><p>%%content_summary%%</p>
filters: [title, category_id, is_published]
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: plain, params: date_format='dd/MM' }
methods:
post:
- "post{title}"
- "post{body}"
names:
post{title}:
required: Yes
required_msg: You must provide a title
post{body}:
required: No
validators: [antiSpamValidator, MyStringValidator]
fillin:
activate: on
generator:
class: sfPropelAdminGenerator
param:
model_class: Post
theme: mytheme ## custom theme
css: admin/mystylesheet ## custom css
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:
name: 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]
fields:
my_field:
name: ## 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: { name: Author }
list:
fields:
author: { help: This is the author of the comment }
edit:
fields:
author: { name: 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
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: { name: Number of comments }
public function getNbComments()
{
return count($this->getComments());
}
list:
display: [_post_link]
fields:
post_link: { name: Related Post }
<php echo link_to( $comment->getPost()->getTitle(), 'post/edit?id='.$comment->getPostId() ) ?>Partials gain automatic access to the current object $<object>.