/
PluginPollSlotEditForm.class.php
46 lines (36 loc) · 1.42 KB
/
PluginPollSlotEditForm.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/*
* This file is part of the apostrophePollPlugin package.
* (c) 2012 Raffaele Bolliger <raffaele.bolliger@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
*
* @author Raffaele Bolliger
*/
class PluginPollSlotEditForm extends BaseForm {
// Ensures unique IDs throughout the page
protected $id;
public function __construct($id, $defaults = array(), $options = array(), $CSRFSecret = null) {
$this->id = $id;
parent::__construct($defaults, $options, $CSRFSecret);
}
public function configure() {
$this->setWidgets(array('poll' => new sfWidgetFormDoctrineChoice(array(
'model' => 'aPollPoll',
'label' => 'Poll',
))));
$this->setValidators(array('poll' => new sfValidatorDoctrineChoice(array(
'model' => 'aPollPoll',
'required' => true,
))));
// Ensures unique IDs throughout the page. Hyphen between slot and form to please our CSS
$this->widgetSchema->setNameFormat('slot-form-' . $this->id . '[%s]');
// You don't have to use our form formatter, but it makes things nice
$this->widgetSchema->setFormFormatterName('aAdmin');
// setting translation catalogue
$this->widgetSchema->getFormFormatter()->setTranslationCatalogue('apostrophe');
}
}