root/trunk/apps/main/lib/FormTemplateListener.class.php

Revision 56, 0.8 kB (checked in by nperriault, 2 years ago)

trunk still broken at this time, but work has progressed:

  • updated sfGuardAuth local module to use 1.1 forms
  • added FormTemplateListener? to listen for filter_parameters event, and handle passed sfForm object instances
  • moved from cryptographp to recpatcha
  • moved sfValidatorBlacklist to sfFormExtraPlugin
  • lib/ folder layout
  • removed jQueryHelper (unused)
Line 
1 <?php
2
3 class FormTemplateListener
4 {
5   protected
6     $activeForm = null;
7  
8   static public function register(sfEventDispatcher $dispatcher)
9   {
10     $dispatcher->connect('template.filter_parameters', array(new self(), 'filterTemplateParameters'));
11   }
12
13   public function filterTemplateParameters(sfEvent $event, $parameters)
14   {
15     switch ($parameters['sf_type'])
16     {
17       case 'layout':
18         $parameters['activeForm'] = is_null($this->activeForm) ? null : $this->activeForm;
19         break;
20       case 'action':
21         foreach ($parameters as $key => $value)
22         {
23           if ($value instanceof sfForm && $value->isBound())
24           {
25             $this->activeForm = $value;
26             break;
27           }
28         }
29         break;
30     }
31
32     return $parameters;
33   }
34 }
35
Note: See TracBrowser for help on using the browser.