| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
|
| 6 |
/** |
| 7 |
* @since 3.0 |
| 8 |
*/ |
| 9 |
class FrmFieldRadio extends FrmFieldType { |
| 10 |
|
| 11 |
/** |
| 12 |
* @var string |
| 13 |
* @since 3.0 |
| 14 |
*/ |
| 15 |
protected $type = 'radio'; |
| 16 |
|
| 17 |
/** |
| 18 |
* @var bool |
| 19 |
* @since 3.0 |
| 20 |
*/ |
| 21 |
protected $holds_email_values = true; |
| 22 |
|
| 23 |
/** |
| 24 |
* Does the html for this field label need to include "for"? |
| 25 |
* |
| 26 |
* @var bool |
| 27 |
* @since 3.06.01 |
| 28 |
*/ |
| 29 |
protected $has_for_label = false; |
| 30 |
|
| 31 |
/** |
| 32 |
* @var bool |
| 33 |
*/ |
| 34 |
protected $array_allowed = false; |
| 35 |
|
| 36 |
protected function input_html() { |
| 37 |
return $this->multiple_input_html(); |
| 38 |
} |
| 39 |
|
| 40 |
protected function include_form_builder_file() { |
| 41 |
return $this->include_front_form_file(); |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Get the type of field being displayed. |
| 46 |
* |
| 47 |
* @since 4.02.01 |
| 48 |
* @return array |
| 49 |
*/ |
| 50 |
public function displayed_field_type( $field ) { |
| 51 |
return array( |
| 52 |
$this->type => true, |
| 53 |
); |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* @return array |
| 58 |
*/ |
| 59 |
protected function extra_field_opts() { |
| 60 |
$form_id = $this->get_field_column( 'form_id' ); |
| 61 |
|
| 62 |
return array( |
| 63 |
'align' => FrmStylesController::get_style_val( 'radio_align', ( empty( $form_id ) ? 'default' : $form_id ) ), |
| 64 |
); |
| 65 |
} |
| 66 |
|
| 67 |
/** |
| 68 |
* @return string[] |
| 69 |
*/ |
| 70 |
protected function new_field_settings() { |
| 71 |
return array( |
| 72 |
'options' => serialize( |
| 73 |
array( |
| 74 |
__( 'Option 1', 'formidable' ), |
| 75 |
__( 'Option 2', 'formidable' ), |
| 76 |
) |
| 77 |
), |
| 78 |
); |
| 79 |
} |
| 80 |
|
| 81 |
/** |
| 82 |
* @since 4.06 |
| 83 |
* |
| 84 |
* @return void |
| 85 |
*/ |
| 86 |
protected function show_priority_field_choices( $args = array() ) { |
| 87 |
include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/radio-images.php'; |
| 88 |
} |
| 89 |
|
| 90 |
/** |
| 91 |
* @return string |
| 92 |
*/ |
| 93 |
protected function include_front_form_file() { |
| 94 |
return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/front-end/radio-field.php'; |
| 95 |
} |
| 96 |
|
| 97 |
/** |
| 98 |
* @return bool |
| 99 |
*/ |
| 100 |
protected function show_readonly_hidden() { |
| 101 |
return true; |
| 102 |
} |
| 103 |
} |
| 104 |
|