100% found this document useful (7 votes)
5K views1 page

Symfony Admin Generator Reference Card

The document provides reference information for using the symfony admin generator, including details on commands, templates, fields, display options, and input types for generating admin interfaces for managing database objects like posts and comments.

Uploaded by

ijayasin
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (7 votes)
5K views1 page

Symfony Admin Generator Reference Card

The document provides reference information for using the symfony admin generator, including details on commands, templates, fields, display options, and input types for generating admin interfaces for managing database objects like posts and comments.

Uploaded by

ijayasin
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

» symfony admin generator reference card 1.

0 «
Command Line Presentation Fields
Options in this order: <APP> <MODULE> <OBJECT> generator: Parameters
class: sfPropelAdminGenerator
$ symfony propel-init-admin backend post Post param: fields:
$ symfony propel-init-admin backend comment Comment my_field:
model_class: Post
name: ## Field label/header
theme: mytheme ## custom theme
Generated code (can be overridden per module) css: admin/mystylesheet ## custom css help: ## Tooltip, displays when requested
accessible in cache/backend/<ENV>/modules/<MODULE> type: ## for edit view only, see below
credentials: ## Classic AND/OR credentials array
Actions Templates Display (ordering and grouping) params: ## html options, depending on the tag
create -> edit _edit_actions.php list view Cascade
delete _edit_footer.php
The equal sign (=) selects the field holding the hyperlink to the edit view First declaration covers the whole module
edit _edit_header.php
list: can be specialized for each view
index -> list _filters.php
## tabular layout fields:
list _list_actions.php
display: [=title, author_id, created_at] author: { name: Author }
save -> edit _list_footer.php
_list_header.php
list:
Methods ## stacked layout fields:
_list_td_actions.php
public handleErrorEdit() layout: stacked author: { help: This is the author of the comment }
_list_td_stacked.php
protected save<OBJECT>() display: [title, author_id, created_at] edit:
_list_td_tabular.php
protected delete<OBJECT>() params: | fields:
_list_th_tabular.php
protected update<OBJECT>FromRequest() <strong>%%=title%%</strong> author: { name: Author of the comment }
_list_th_stacked.php
protected get<OBJECT>OrCreate() by %%author%% (issued on %%created_at%%)
editSuccess.php Input types
protected processFilters() Stacked layout uses display setting for the column headers (and sorting)
listSuccess.php fields:
protected processSort() edit view
protected addFiltersCriteria() my_field:
edit: type:
protected addSortCriteria()
## ungrouped plain ## No input
display: [title, author_id, created_at] input_tag ## Default for text, numeric
generator.yml
textarea_tag ## Default for longvarchar
generator: ## grouped input_date_tag ## Default for date and timestamp
class: sfPropelAdminGenerator display: select_tag ## Default for foreign keys
param: "NONE": [id] ## And for booleans
model_class: Post "Group1": [title, body] checkbox_tag
theme: default "Group2": [created_at] radiobutton_tag
Groups with label "NONE" have no label admin_input_upload_tag
fields:
Usual params
author_id: { name: Post author } Additional list settings
fields:
list: Filters my_field:
title: symfony blog posts filters: params:
display: [title, author_id, category_id] - title ## text filter, accepts * as wildcard disabled=true
fields: - author ## foreign_key filter, displays select date_format='MM/dd/yy' ## For dates
published_on: { params: date_format='dd/MM/yy' } - created_at ## date filter from... to... include_blank=true ## For select tags
layout: stacked - is_admin ## boolean filter, yes/no/yes or no include_custom=Choose from the list
params: | size=45x5 ## For textareas
Pagination rich=true
%%is_published%%<strong>%%=title%%</strong><br />
<em>by %%author%% in %%category%% max_per_page: 10 ## maximum number of records per page tinymce_options=height:150
(%%published_on%%)</em><p>%%content_summary%%</p> Sorting
filters: [title, category_id, is_published] sort: created_at ## sort column (ascending order by default) Special fields
max_per_page: 2 sort: [created_at, desc] ## desc sort order Custom fields
edit: Interactions Fields not defined in the schema.xml but for which a custom getter and/or setter were defined in the
title: Editing post "%%title%%" model.
display: Default actions list: modules/post/config/generator.yml
"Post": [title, category_id, content] list: display: [nb_comments]
"Workflow": [author_id, is_published, created_on] object_actions: fields:
fields: _edit: - nb_comments: { name: Number of comments }
category_id: { params: disabled=true } _delete: -
content: public function getNbComments() apps/lib/model/Post.php
actions:
params: rich=true tinymce_options=height:150 _create: - {
author_id: return count($this->getComments());
edit:
params: size=5 include_custom=Choose an author }
actions:
is_published: { credentials: [[admin, superdamin]] } _list: - Partial fields
created_on: { type: plain, params: date_format='dd/MM' } _save: - Fields declared with a _ prefix in the display: key refer to a partial in the module's template/ dir.
_save_and_add: - Use the name without prefix under the fields: key.
Validation & Repopulation _delete: - list: modules/comment/config/generator.yml
methods: apps/backend/modules/post/validate/edit.yml Parameters display: [_post_link]
post: fields:
actions:
- "post{title}" post_link: { name: Related Post }
my_action:
- "post{body}" name: Add a comment
names: <php echo link_to( modules/comment/templates/_post_link.php
action: addComment
post{title}: $comment->getPost()->getTitle(),
icon: backend/addcomment.png
required: Yes 'post/edit?id='.$comment->getPostId()
only_for: edit ## Restrict to edit or create
required_msg: You must provide a title ) ?>
params: class=foobar confirm=Are you sure?
post{body}: Partials gain automatic access to the current object $<object>.
credentials: [[admin, superuser], owner]
required: No
validators: [antiSpamValidator, MyStringValidator]
fillin:
activate: on

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy