sfWpAdminPlugin - 1.0.2

Administration menu plugin.

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Releases Changelog Contribute
Show source

sfWpAdmin plugin

The sfWpAdminPlugin is a symfony plugin that provides an easy to customize and implement Wordpress inspired menu for your projects backend.


  • Install the plugin (via a package)

    symfony plugin:install sfWpAdminPlugin
  • Install the plugin (via a Subversion checkout)

    svn co http://svn.symfony-project.com/plugins/sfWpAdminPlugin/trunk plugins/sfWpAdminPlugin
  • Activate the plugin in the config/ProjectConfiguration.class.php

    class ProjectConfiguration extends sfProjectConfiguration
      public function setup()
  • Activate the sfWpAdmin module in your 'settings.yml'

        enabled_modules:        [default, sfWpAdmin]
  • Include the sfWpAdminPlugin header in footer in your layout

    /* if you use include_stylesheets() make sure to add the WpAdmin assets */
    <?php sfWpAdmin::addAssets() ?>
    <?php include_stylesheets() ?>
      <?php echo $sf_data->getRaw('sf_content') ?>
  • Add sfWpAdmin options and your applications menu structure in your 'app.yml'

        site:                         My Site
          Item 1:
            Child 1:
              module:      module_name
              action:      action_name
              parameters:  [ do: child 1 ]
              credentials: [ foobar ]
                - { module: alternate_module, action: alternate_action, parameters: [ id: 1 ] }
  • Clear you cache

    symfony cc

Login screen

To use the wordpress style login screen you need a form having the same fields as sfGuardFormSignin (eg: username, password, remember).

To activate the login action simply edit your 'settings.yml' to this:

all: .actions: login_module: sfWpAdmin # To be called when a non-authenticated user login_action: login # Tries to access a secure page

Sample menu setup

  items:                                              # Menu items that will show up in the main menu
    Create:                                           # Main Group name
      Article:                                        # Full name
        module:     article                           # Module name
        action:     new                               # Action name
        parameters: [type: text]                      # Extra parameters to match
        alias:                                        # Extra routes that will match this item
          - { module: article, action: create, parameters: [type: text] }
        module:          article
        action:          new
        parameters:      [type: slideshow]
        credentials:     [photo_editor, editor]       # Menu item will not be shown if user lacks credeantials
          - { module: article, action: create, parameters: [type: slideshow] }
        module:     media
        action:     index
        parameters: []
          - { module: media, action: edit }
          - { module: media, action: new }
          - { module: media, action: create }
          - { module: media, action: update }
  sub_items:                                         # Menu items that will show up on the right side
        module:     sfGuardUser
        action:     index
        parameters: []
          - { module: sfGuardUser, action: edit }
          - { module: sfGuardUser, action: new }
          - { module: sfGuardUser, action: create }
          - { module: sfGuardUser, action: update }

Available sfWpAdmin options

  web_dir:                      /sfWpAdminPlugin/           # web path for the 'sfWpAdminPlugin/web' directory
  image_dir:                    /sfWpAdminPlugin/images/    # web path for the 'sfWpAdminPlugin/web/images/' directory
  site_url:                     /                           # url used for the '< Back to website' link
  logout:                       true                        # show the logout link ?
  site:                         My Site                     # the name of your website
  login_form_class:             sfGuardFormSignin           # form class used for the login page
  homepage:                     @homepage                   # route to applications homepage
  login_route:                  sfWpAdminPlugin/login       # login route
  logout_route:                 sfWpAdminPlugin/logout      # logout route

To do

There are probably a few bugs out there, as I build this plugin to be used mainly with the sfGuard plugin, I'll get arround fixing them soon enough.

Also comming soon is a wordpress based admin generator theme.