| 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 FrmFieldSelect extends FrmFieldType { |
| 10 |
|
| 11 |
/** |
| 12 |
* @var string |
| 13 |
* @since 3.0 |
| 14 |
*/ |
| 15 |
protected $type = 'select'; |
| 16 |
|
| 17 |
/** |
| 18 |
* @var bool |
| 19 |
* @since 3.0 |
| 20 |
*/ |
| 21 |
protected $holds_email_values = true; |
| 22 |
|
| 23 |
protected function include_form_builder_file() { |
| 24 |
return $this->include_front_form_file(); |
| 25 |
} |
| 26 |
|
| 27 |
protected function field_settings_for_type() { |
| 28 |
return array( |
| 29 |
'clear_on_focus' => true, |
| 30 |
'size' => true, |
| 31 |
); |
| 32 |
} |
| 33 |
|
| 34 |
protected function new_field_settings() { |
| 35 |
return array( |
| 36 |
'options' => serialize( |
| 37 |
array( |
| 38 |
'', |
| 39 |
__( 'Option 1', 'formidable' ), |
| 40 |
) |
| 41 |
), |
| 42 |
); |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* Get the type of field being displayed. |
| 47 |
* |
| 48 |
* @since 4.02.01 |
| 49 |
* @return array |
| 50 |
*/ |
| 51 |
public function displayed_field_type( $field ) { |
| 52 |
return array( |
| 53 |
$this->type => true, |
| 54 |
); |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* @since 4.0 |
| 59 |
* @param array $args - Includes 'field', 'display', and 'values' |
| 60 |
*/ |
| 61 |
public function show_extra_field_choices( $args ) { |
| 62 |
$this->auto_width_setting( $args ); |
| 63 |
} |
| 64 |
|
| 65 |
protected function include_front_form_file() { |
| 66 |
return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/front-end/dropdown-field.php'; |
| 67 |
} |
| 68 |
|
| 69 |
protected function show_readonly_hidden() { |
| 70 |
return true; |
| 71 |
} |
| 72 |
|
| 73 |
protected function prepare_import_value( $value, $atts ) { |
| 74 |
if ( FrmField::is_option_true( $this->field, 'multiple' ) ) { |
| 75 |
$value = $this->get_multi_opts_for_import( $value ); |
| 76 |
} |
| 77 |
|
| 78 |
return $value; |
| 79 |
} |
| 80 |
} |
| 81 |
|