Development

/branches/1.1/lib/widget/sfWidgetFormSchemaDecorator.class.php

You must first sign up to be able to contribute.

root/branches/1.1/lib/widget/sfWidgetFormSchemaDecorator.class.php

Revision 9046, 5.8 kB (checked in by FabianLange, 7 years ago)

1.1: fixed @param phpdoc to fit specs in widgets (refs #2991)

  • 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) 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  * sfWidgetFormSchemaDecorator wraps a form schema widget inside a given HTML snippet.
13  *
14  * @package    symfony
15  * @subpackage widget
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
18  */
19 class sfWidgetFormSchemaDecorator extends sfWidgetFormSchema
20 {
21   protected
22     $widget    = null,
23     $decorator = '';
24
25   /**
26    * Constructor.
27    *
28    * @param sfWidgetFormSchema $widget     A sfWidgetFormSchema instance
29    * @param string             $decorator  A decorator string
30    *
31    * @see sfWidgetFormSchema
32    */
33   public function __construct(sfWidgetFormSchema $widget, $decorator)
34   {
35     $this->widget    = $widget;
36     $this->decorator = $decorator;
37
38     parent::__construct();
39   }
40
41   /**
42    * Returns the decorated widget.
43    *
44    * @param sfWidget The decorated widget
45    */
46   public function getWidget()
47   {
48     return $this->widget;
49   }
50
51   /**
52    * @param  string $name        The element name
53    * @param  string $value       The value displayed in this widget
54    * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
55    * @param  array  $errors      An array of errors for the field
56    *
57    * @see sfWidget
58    */
59   public function render($name, $values = array(), $attributes = array(), $errors = array())
60   {
61     return strtr($this->decorator, array('%content%' => $this->widget->render($name, $values, $attributes, $errors)));
62   }
63
64   /**
65    * @see sfWidgetFormSchema
66    */
67   public function addFormFormatter($name, sfWidgetFormSchemaFormatter $formatter)
68   {
69     return $this->widget->addFormFormatter($name, $formatter);
70   }
71
72   /**
73    * @see sfWidgetFormSchema
74    */
75   public function getFormFormatters()
76   {
77     return $this->widget->getFormFormatters();
78   }
79
80   /**
81    * @see sfWidgetFormSchema
82    */
83   public function setFormFormatterName($name)
84   {
85     $this->widget->setFormFormatterName($name);
86   }
87
88   /**
89    * @see sfWidgetFormSchema
90    */
91   public function getFormFormatterName()
92   {
93     return $this->widget->getFormFormatterName();
94   }
95
96   /**
97    * @see sfWidgetFormSchema
98    */
99   public function getFormFormatter()
100   {
101     return $this->widget->getFormFormatter();
102   }
103
104   /**
105    * @see sfWidgetFormSchema
106    */
107   public function setNameFormat($format)
108   {
109     $this->widget->setNameFormat($format);
110   }
111
112   /**
113    * @see sfWidgetFormSchema
114    */
115   public function getNameFormat()
116   {
117     return $this->widget->getNameFormat();
118   }
119
120   /**
121    * @see sfWidgetFormSchema
122    */
123   public function setLabels($labels)
124   {
125     $this->widget->setLabels($labels);
126   }
127
128   /**
129    * @see sfWidgetFormSchema
130    */
131   public function getLabels()
132   {
133     return $this->widget->getLabels();
134   }
135
136   /**
137    * @see sfWidgetFormSchema
138    */
139   public function setLabel($name, $value)
140   {
141     $this->widget->setLabel($name, $value);
142   }
143
144   /**
145    * @see sfWidgetFormSchema
146    */
147   public function getLabel($name)
148   {
149     return $this->widget->getLabel($name);
150   }
151
152   /**
153    * @see sfWidgetFormSchema
154    */
155   public function setHelps($helps)
156   {
157     $this->widget->setHelps($helps);
158   }
159
160   /**
161    * @see sfWidgetFormSchema
162    */
163   public function getHelps()
164   {
165     return $this->widget->getHelps();
166   }
167
168   /**
169    * @see sfWidgetFormSchema
170    */
171   public function setHelp($name, $help)
172   {
173     $this->widget->setHelp($name, $help);
174   }
175
176   /**
177    * @see sfWidgetFormSchema
178    */
179   public function getHelp($name)
180   {
181     return $this->widget->getHelp($name);
182   }
183
184   /**
185    * @see sfWidgetFormSchema
186    */
187   public function needsMultipartForm()
188   {
189     return $this->widget->needsMultipartForm();
190   }
191
192   /**
193    * @see sfWidgetFormSchema
194    */
195   public function renderField($name, $value = null, $attributes = array(), $errors = array())
196   {
197     return $this->widget->renderField($name, $value, $attributes, $errors);
198   }
199
200   /**
201    * @see sfWidgetFormSchemaFormatter
202    */
203   public function generateLabel($name)
204   {
205     return $this->widget->getFormFormatter()->generateLabel($name);
206   }
207
208   /**
209    * @see sfWidgetFormSchemaFormatter
210    */
211   public function generateLabelName($name)
212   {
213     return $this->widget->getFormFormatter()->generateLabelName($name);
214   }
215
216   /**
217    * @see sfWidgetFormSchema
218    */
219   public function generateName($name)
220   {
221     return $this->widget->generateName($name);
222   }
223
224   /**
225    * @see sfWidgetFormSchema
226    */
227   public function getParent()
228   {
229     return $this->widget->getParent();
230   }
231
232   /**
233    * @see sfWidgetFormSchema
234    */
235   public function setParent(sfWidgetFormSchema $parent = null)
236   {
237     $this->widget->setParent($parent);
238   }
239
240   /**
241    * @see sfWidgetFormSchema
242    */
243   public function getFields()
244   {
245     return $this->widget->getFields();
246   }
247
248   /**
249    * @see sfWidgetFormSchema
250    */
251   public function getPositions()
252   {
253     return $this->widget->getPositions();
254   }
255
256   /**
257    * @see sfWidgetFormSchema
258    */
259   public function setPositions($positions)
260   {
261     $this->widget->setPositions($positions);
262   }
263
264   /**
265    * @see sfWidgetFormSchema
266    */
267   public function moveField($field, $action, $pivot = null)
268   {
269     return $this->widget->moveField($field, $action, $pivot);
270   }
271
272   /**
273    * @see sfWidgetFormSchema
274    */
275   public function offsetExists($name)
276   {
277     return isset($this->widget[$name]);
278   }
279
280   /**
281    * @see sfWidgetFormSchema
282    */
283   public function offsetGet($name)
284   {
285     return $this->widget[$name];
286   }
287
288   /**
289    * @see sfWidgetFormSchema
290    */
291   public function offsetSet($name, $widget)
292   {
293     $this->widget[$name] = $widget;
294   }
295
296   /**
297    * @see sfWidgetFormSchema
298    */
299   public function offsetUnset($name)
300   {
301     unset($this->widget[$name]);
302   }
303
304   public function __clone()
305   {
306     $this->widget = clone $this->widget;
307   }
308 }
309
Note: See TracBrowser for help on using the browser.