1 | <?php |
||
12 | class GF_Field extends Field { |
||
13 | |||
14 | /** |
||
15 | * @var \GF_Field The backing Gravity Forms field. |
||
16 | */ |
||
17 | public $field; |
||
18 | |||
19 | /** |
||
20 | * Create self from a configuration array. |
||
21 | * |
||
22 | * @param array $configuration The configuration array. |
||
23 | * @see \GV\Field::as_configuration() |
||
24 | * @internal |
||
25 | * @since 2.0 |
||
26 | * |
||
27 | * @return \GV\GF_Field|null The field implementation or null on error. |
||
28 | */ |
||
29 | 67 | public static function from_configuration( $configuration ) { |
|
50 | |||
51 | /** |
||
52 | * Get a \GV\GF_Field by \GV\GF_Form and Field ID. |
||
53 | * |
||
54 | * @param \GV\GF_Form $form The Gravity Form form. |
||
55 | * @param int $field_id The Gravity Form field ID for the $form. |
||
56 | * |
||
57 | * @return \GV\Field|null The requested field or null if not found. |
||
58 | */ |
||
59 | 67 | public static function by_id( $form, $field_id ) { |
|
85 | |||
86 | /** |
||
87 | * Retrieve the label for this field. |
||
88 | * |
||
89 | * Requires a \GV\GF_Form in this implementation. |
||
90 | * |
||
91 | * @param \GV\View $view The view for this context if applicable. |
||
92 | * @param \GV\Source $source The source (form) for this context if applicable. |
||
93 | * @param \GV\Entry $entry The entry for this context if applicable. |
||
94 | * @param \GV\Request $request The request for this context if applicable. |
||
95 | * |
||
96 | * @return string The label for this Gravity Forms field. |
||
97 | */ |
||
98 | 17 | public function get_label( View $view = null, Source $source = null, Entry $entry = null, Request $request = null ) { |
|
126 | |||
127 | /** |
||
128 | * Retrieve the value for this field. |
||
129 | * |
||
130 | * Requires a \GV\GF_Entry in this implementation. |
||
131 | * |
||
132 | * @param \GV\View $view The view for this context if applicable. |
||
133 | * @param \GV\Source $source The source (form) for this context if applicable. |
||
134 | * @param \GV\Entry $entry The entry for this context if applicable. |
||
135 | * @param \GV\Request $request The request for this context if applicable. |
||
136 | * |
||
137 | * @return mixed The value for this field. |
||
138 | */ |
||
139 | 40 | public function get_value( View $view = null, Source $source = null, Entry $entry = null, Request $request = null ) { |
|
150 | |||
151 | /** |
||
152 | * A proxy getter for the backing GravityView field. |
||
153 | * |
||
154 | * The view field configuration is checked first, though. |
||
155 | * |
||
156 | * @param string $key The property to get. |
||
157 | * |
||
158 | * @return mixed The value of the Gravity View field property, or null if not exists. |
||
159 | */ |
||
160 | 53 | public function __get( $key ) { |
|
169 | } |
||
170 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.