Symfony has been nominated for the following 3 Community Choice Awards:
- Best Project
- Best Tool or Utility for Developers
- Best Project for the Enterprise
Symfony has been nominated for the following 3 Community Choice Awards:
The sfAdminDashPlugin is maintained by Kevin Bond (not by me) and as of this morning, is confirmed to be used by 8 people (let's get this up higher!). The best way to get a feel for it, is to play around with the plugin. This admin area let's you play around with the todo list items as well as both the author and publication items seen in previous posts.
Below are the steps I followed to configure the plugin. The official ReadMe is great (I reference it below) and should be used as well.
While splitting your site into 2 different applications (one for the frontend and one for the backend) isn't necessary, I recommend it. Back in the day, I chose to fit both my frontend and backend modules into the same application so that I could more easily link between the two and control the cache. I now disagree with past-self. If you need to communicate between your applications, you can initialize a new context of the other application, which actually proves to be pretty easy. Fabien illustrates this approach using the routing system here.
./symfony generate:app backend
This is the easy housekeeping step, so I won't repeat the obvious. Check the plugin's official page for more details. Here's a concise list of what you need to do:
The highly-configurable admin navigation drop-down menu is the real high point of this plugin. Everything is configurable from within the app.yml file. Here's what mine looks like:
all:
sf_admin_dash:
web_dir: /sfAdminDashPlugin
image_dir: /sfAdminDashPlugin/images/icons/
default_image: config.png
resize_mode: thumbnail
logout: yes
site: Thatsquality.com Admin
include_jquery: yes
categories:
"Todo List":
credentials: [todo_credential]
items:
Todos:
url: todo
image: checkin.png
"Authors & Books":
credentials: [[author_credential, publication_credential]]
items:
Authors:
credentials: [author_credential]
url: author
image: users.png
Publications:
credentials: [publication_credential]
url: publication
image: addedit.png
For a more complete reference, please see the official plugin page. The menu can be configured either by groups (as you see here) or by just a flat list of items. In either case, credentials can be added so that you can control what type of user see which items. The nice part is that these credentials can be added at the group level or at the item level (both are seen above).
One of the most attractive features of this plugin is that it comes with a short list of icons that you can use to really make your admin area shine. These are available in the sfAdminDashPlugin/web/images/icons folder and you can configure each item to use any icon via the image parameter seen above.
While you can use this plugin without it, it's almost always a good idea to use sfGuardPlugin. Information on installing and configuring sfGuardPlugin can be found here. I'll assume you've got this all setup already.
sfAdminDash comes packged with a cute login screen I like to use. With sfGuardPlugin, this is easy. To do this, we'll create an sfGuardAuth module so that we can override a few files from the plugin (specifically the signinSuccess.php template and the actions.class.php file).
mkdir apps/backend/modules/sfGuardAuth mkdir apps/backend/modules/sfGuardAuth/actions mkdir apps/backend/modules/sfGuardAuth/templates
// apps/backend/modules/sfGuardAuth/templates/signinSuccess.php <?php include_partial('sfAdminDash/login', array('form' => $form)); ?> // apps/backend/modules/sfGuardAuth/actions/actions.class.php <?php require_once(sfConfig::get('sf_root_dir').'/plugins/sfGuardPlugin/modules/sfGuardAuth/lib/BasesfGuardAuthActions.class.php'); class sfGuardAuthActions extends BasesfGuardAuthActions { public function preExecute() { sfForm::disableCSRFProtection(); } }
The modification to the actions.class.php is necessary because the login form doesn't add the csrf_token, so if you try to use one, an error will be thrown. I think this is a mistake, and the plugin should - at the very least - check to see if our form is using a csrf_token and display it if it is. But maybe I'm not considering something?
The beauty of this plugin is that it's quick and dirty, but leaves you with an attractive and functional admin section. On that note, I only have a few complaints, and they're pretty minor. Overall, I think this plugin rocks!