name = __( 'Radio', 'weforms' ); $this->input_type = 'radio_field'; $this->icon = 'dot-circle-o'; } /** * Render the text field * * @param array $field_settings * @param integer $form_id * * @return void */ public function render( $field_settings, $form_id ) { $selected = isset( $field_settings['selected'] ) ? $field_settings['selected'] : ''; ?>
  • print_list_attributes( $field_settings ); ?>> print_label( $field_settings, $form_id ); ?>
    0 ) { foreach ($field_settings['options'] as $value => $option) { ?> help_text( $field_settings ); ?>
  • get_default_option_settings( true, array( 'width' ) ); $dropdown_options = array( $this->get_default_option_dropdown_settings(), array( 'name' => 'inline', 'title' => __( 'Show in inline list', 'weforms' ), 'type' => 'radio', 'options' => array( 'yes' => __( 'Yes', 'weforms' ), 'no' => __( 'No', 'weforms' ), ), 'default' => 'no', 'inline' => true, 'section' => 'advanced', 'priority' => 23, 'help_text' => __( 'Show this option in an inline list', 'weforms' ), ) ); return array_merge( $default_options, $dropdown_options ); } /** * Get the field props * * @return array */ public function get_field_props() { $defaults = $this->default_attributes(); $props = array( 'selected' => '', 'inline' => 'no', 'options' => array( 'Option' => __( 'Option', 'weforms' ) ), ); return array_merge( $defaults, $props ); } /** * Prepare entry * * @param $field * * @return mixed */ public function prepare_entry( $field ) { $val = $_POST[$field['name']]; return isset( $field['options'][$val] ) ? $field['options'][$val] : ''; } }