SlideShare a Scribd company logo
» 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

More Related Content

PDF
429 e8d01
KEY
Getting started with Rails (2), Season 2
PDF
Database Oracle Basic
PDF
Drupal Workshop: Introducción al Backend de Drupal
PDF
Developing for the WordPress Customizer
PDF
Symfony ORM
KEY
Apostrophe (improved Paris edition)
PDF
429 e8d01
Getting started with Rails (2), Season 2
Database Oracle Basic
Drupal Workshop: Introducción al Backend de Drupal
Developing for the WordPress Customizer
Symfony ORM
Apostrophe (improved Paris edition)

Similar to Symfony Admin Generator (20)

PDF
Ruby on Rails at PROMPT ISEL '11
DOCX
Web-based application development part 31MINIMIZE .docx
PDF
Curso Symfony - Clase 3
PDF
Drupal 7 Theming - Behind the scenes
PDF
The Rails Way
PDF
RubyOnRails-Cheatsheet-BlaineKendall
PDF
RubyOnRails-Cheatsheet-BlaineKendall
PPT
Symfony Admin Generator - generator.yml
PDF
Rails Plugin Development 101 (...and some...)
PDF
Rails vs Web2py
PPT
Jquery presentation
PPT
Oops concepts in php
PDF
Modx Evo Basic Cheatsheet 1 3
PDF
Rails2 Pr
PDF
Ruby on Rails ステップアップ講座 - 大場寧子
PDF
Debugging on rails
PDF
Working With The Symfony Admin Generator
PDF
Laravel tips-2019-04
PDF
Debugging on Rails. Mykhaylo Sorochan
PPTX
WordPress Structure and Best Practices
Ruby on Rails at PROMPT ISEL '11
Web-based application development part 31MINIMIZE .docx
Curso Symfony - Clase 3
Drupal 7 Theming - Behind the scenes
The Rails Way
RubyOnRails-Cheatsheet-BlaineKendall
RubyOnRails-Cheatsheet-BlaineKendall
Symfony Admin Generator - generator.yml
Rails Plugin Development 101 (...and some...)
Rails vs Web2py
Jquery presentation
Oops concepts in php
Modx Evo Basic Cheatsheet 1 3
Rails2 Pr
Ruby on Rails ステップアップ講座 - 大場寧子
Debugging on rails
Working With The Symfony Admin Generator
Laravel tips-2019-04
Debugging on Rails. Mykhaylo Sorochan
WordPress Structure and Best Practices
Ad

Recently uploaded (20)

PPTX
Machine Learning_overview_presentation.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Encapsulation theory and applications.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
A Presentation on Artificial Intelligence
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Cloud computing and distributed systems.
PDF
Approach and Philosophy of On baking technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
Machine Learning_overview_presentation.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
sap open course for s4hana steps from ECC to s4
Encapsulation theory and applications.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
cuic standard and advanced reporting.pdf
A comparative analysis of optical character recognition models for extracting...
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Programs and apps: productivity, graphics, security and other tools
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
A Presentation on Artificial Intelligence
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Chapter 3 Spatial Domain Image Processing.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Cloud computing and distributed systems.
Approach and Philosophy of On baking technology
Encapsulation_ Review paper, used for researhc scholars
Reach Out and Touch Someone: Haptics and Empathic Computing
Ad

Symfony Admin Generator

  • 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