WordPress.org

Plugin Directory

Changeset 608426


Ignore:
Timestamp:
10/05/12 11:17:02 (19 months ago)
Author:
kovshenin
Message:

Adding a radio select question type.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • camptix/trunk/camptix.php

    r608425 r608426  
    29492949            'text' => __( 'Text input', 'camptix' ), 
    29502950            'textarea' => __( 'Text area', 'camptix' ), 
    2951             'select' => __( 'Dropdown Select', 'camptix' ), 
     2951            'select' => __( 'Dropdown select', 'camptix' ), 
     2952            'radio' => __( 'Radio select', 'camptix' ), 
    29522953            'checkbox' => __( 'Checkbox', 'camptix' ), 
    29532954        ) ); 
     
    29622963        add_action( 'camptix_question_field_checkbox', array( $this, 'question_field_checkbox' ), 10, 3 ); 
    29632964        add_action( 'camptix_question_field_textarea', array( $this, 'question_field_textarea' ), 10, 2 ); 
     2965        add_action( 'camptix_question_field_radio', array( $this, 'question_field_radio' ), 10, 3 ); 
    29642966    } 
    29652967 
     
    30073009        ?> 
    30083010        <textarea name="<?php echo esc_attr( $name ); ?>"><?php echo esc_textarea( $value ); ?></textarea> 
     3011        <?php 
     3012    } 
     3013 
     3014    /** 
     3015     * A radio input for questions. 
     3016     */ 
     3017    function question_field_radio( $name, $user_value, $question ) { 
     3018        ?> 
     3019        <?php foreach ( (array) $question['values'] as $question_value ) : ?> 
     3020            <label><input <?php checked( $question_value, $user_value ); ?> name="<?php echo esc_attr( $name ); ?>" type="radio" value="<?php echo esc_attr( $question_value ); ?>" /> <?php echo esc_html( $question_value ); ?></label><br /> 
     3021        <?php endforeach; ?> 
    30093022        <?php 
    30103023    } 
Note: See TracChangeset for help on using the changeset viewer.