AnsPress_Form::checkbox_field( array $field = array() )
Description #
Checkbox field.
Parameters #
- $fieldarray (Optional) Field. Default value: array()
Source #
File: includes/class/form.php
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | private function checkbox_field( $field = array () ) { if ( isset( $field [ 'label' ] ) ) { $this ->label(); } $this ->output .= '<div class="ap-form-fields-in">' ; if ( ! empty ( $field [ 'desc' ] ) ) { $this ->output .= '<label for="' . $field [ 'name' ] . '">' ; } $this ->output .= '<input id="' . $field [ 'name' ] . '" type="checkbox" class="ap-form-control" value="1" name="' . $field [ 'name' ] . '" ' . checked( (bool) $field [ 'value' ], true, false ) . ' ' . $this ->attr( $field ) . ' />' ; // Hack for getting value of unchecked checkbox. $this ->output .= '<input type="hidden" value="0" name="_hidden_' . $field [ 'name' ] . '" />' ; if ( ! empty ( $field [ 'desc' ] ) ) { $this ->output .= $field [ 'desc' ] . '</label>' ; } $this ->error_messages(); $this ->output .= '</div>' ; } |
Expand full source code Collapse full source code View on GitHub: includes/class/form.php:354
Add your comment