-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathForm.php
More file actions
72 lines (65 loc) · 2.07 KB
/
Form.php
File metadata and controls
72 lines (65 loc) · 2.07 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* Ztal Form.
*
* @category Namesco
* @package Ztal
* @author Alex Mace <amace@names.co.uk>
* @copyright 2009-2011 Namesco Limited
* @license http://names.co.uk/license Namesco
*/
namespace Ztal;
/**
* Ztal Form.
*
* This makes a few customisations to Zend_Form for use with Ztal applications.
*
* @category Namesco
* @package Ztal
* @author Alex Mace <amace@names.co.uk>
*/
class Form extends \Zend_Form
{
/**
* Constructor.
*
* Turns off Zend_Form translation before calling the parent constructor.
*
* @param mixed $options Set of options for configuring the form.
*/
public function __construct($options = null)
{
// Turn off the translator as this will be done in PHPTAL.
$this->setDisableTranslator(true);
// Call the parent constructor to set up everything else.
parent::__construct($options);
}
/**
* Create an element.
*
* Acts as a factory for creating elements. Elements created with this
* method will not be attached to the form, but will contain element
* settings as specified in the form object (including plugin loader
* prefix paths, default decorators, etc.).
*
* This extends the version in Zend_Form and turns off translation
* and decorators by default.
*
* @param string $type Form element type.
* @param string $name Name of the element.
* @param array|Zend_Config $options Set of configuration options.
*
* @return Zend_Form_Element
*/
public function createElement($type, $name, $options = null)
{
// Turn off the translator by default because we'll be using PHPTAL.
if (!isset($options['disableTranslator'])) {
$options['disableTranslator'] = true;
}
// Turn off loading any decorators because they are unneeded and we use
// decorators to specify what TAL macro to use.
$options['disableLoadDefaultDecorators'] = true;
return parent::createElement($type, $name, $options);
}
}