Development

/branches/1.0/lib/filter/sfFillInFormFilter.class.php

You must first sign up to be able to contribute.

root/branches/1.0/lib/filter/sfFillInFormFilter.class.php

Revision 3244, 1.9 kB (checked in by fabien, 8 years ago)

updated lib/filter/ directory phpdoc

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * sfFillInFormFilter fills in forms.
13  *
14  * @package    symfony
15  * @subpackage filter
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
18  */
19 class sfFillInFormFilter extends sfFilter
20 {
21   /**
22    * Executes this filter.
23    *
24    * @param sfFilterChain A sfFilterChain instance
25    */
26   public function execute($filterChain)
27   {
28     // execute next filter
29     $filterChain->execute();
30
31     $context  = $this->getContext();
32     $response = $context->getResponse();
33     $request  = $context->getRequest();
34
35     $fillInForm = new sfFillInForm();
36
37     // converters
38     foreach ($this->getParameter('converters', array()) as $functionName => $fields)
39     {
40       $fillInForm->addConverter($functionName, $fields);
41     }
42
43     // skip fields
44     $fillInForm->setSkipFields((array) $this->getParameter('skip_fields', array()));
45
46     // types
47     $excludeTypes = (array) $this->getParameter('exclude_types', array('hidden', 'password'));
48     $checkTypes   = (array) $this->getParameter('check_types',   array('text', 'checkbox', 'radio', 'password', 'hidden'));
49     $fillInForm->setTypes(array_diff($checkTypes, $excludeTypes));
50
51     // fill in
52     $method  = 'fillIn'.ucfirst(strtolower($this->getParameter('content_type', 'Html')));
53
54     try
55     {
56       $content = $fillInForm->$method($response->getContent(), $this->getParameter('name'), $this->getParameter('id'), $request->getParameterHolder()->getAll());
57       $response->setContent($content);
58     }
59     catch (sfException $e)
60     {
61       if (sfConfig::get('sf_logging_enabled'))
62       {
63         $this->getContext()->getLogger()->err(sprintf('{sfFilter} %s', $e->getMessage()));
64       }
65     }
66   }
67 }
68
Note: See TracBrowser for help on using the browser.