AnsPress_Form::radio_field( array $field = array() )

Description #

Radio field.

Parameters #

  • $field
    array (Optional) Field. Default value: array()

Changelog #

VersionDescription
2.0.1Introduced.

Source #

File: includes/class/form.php

385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
private function radio_field( $field = [] ) {
    if ( isset( $field['label'] ) ) {
        $this->label();
    }
 
    $this->output .= '<div class="ap-form-fields-in">';
 
    foreach ( (array) $field['options'] as $opt_value => $opt_label ) {
 
        $this->output .= '<label>';
        $this->output .= '<input id="' . $field['name'] . '" type="radio" class="ap-form-control" value="' . esc_attr( $opt_value ) . '" name="' . $field['name'] . '" ' . checked( $opt_value, $field['value'], false ) . ' ' . $this->attr( $field ) . ' />';
 
        $this->output .= $opt_label;
        $this->output .=  '</label>';
    }
 
    if ( ! $this->field['show_desc_tip'] ) {
        $this->desc();
    }
 
    $this->error_messages();
    $this->output .= '</div>';
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment