PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.2.06
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.2.06
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/FrmFieldOption.php +12 -27 6.25.15.2.06 View file →
@@ -8,9 +8,9 @@
8 8 */
9 9 class FrmFieldOption {
10 10
11 11 /**
12 - * @var int|string
12 + * @var string|int
13 13 *
14 14 * @since 2.03.05
15 15 */
16 16 protected $option_key;
@@ -15,9 +15,9 @@
15 15 */
16 16 protected $option_key;
17 17
18 18 /**
19 - * @var array|string
19 + * @var string|array
20 20 *
21 21 * @since 2.03.05
22 22 */
23 23 protected $option;
@@ -44,14 +44,12 @@
44 44 /**
45 45 * Set the option label
46 46 *
47 47 * @since 2.03.05
48 - *
49 - * @return void
50 48 */
51 49 private function set_option_label() {
52 50 if ( is_array( $this->option ) ) {
53 - $this->option_label = ( $this->option['label'] ?? reset( $this->option ) );
51 + $this->option_label = ( isset( $this->option['label'] ) ? $this->option['label'] : reset( $this->option ) );
54 52 } else {
55 53 $this->option_label = $this->option;
56 54 }
57 55 }
@@ -59,10 +57,8 @@
59 57 /**
60 58 * Set the saved value
61 59 *
62 60 * @since 2.03.05
63 - *
64 - * @return void
65 61 */
66 62 protected function set_saved_value() {
67 63 $this->saved_value = $this->option_label;
68 64 }
@@ -71,28 +67,17 @@
71 67 * Print a single option
72 68 *
73 69 * @since 2.03.05
74 70 *
75 - * @param string $selected_value The value of the option to be selected.
76 - * @param int $truncate Truncate the option label if true.
77 - * @param bool $use_value_as_label Use the option value as the label if true.
78 - *
79 - * @return void
71 + * @param string $selected_value
72 + * @param int $truncate
80 73 */
81 - public function print_single_option( $selected_value, $truncate, $use_value_as_label = false ) {
82 - if ( '' === $this->saved_value && ! $use_value_as_label ) {
83 - return;
74 + public function print_single_option( $selected_value, $truncate ) {
75 + if ( '' !== $this->saved_value ) {
76 + echo '<option value="' . esc_attr( $this->saved_value ) . '"';
77 + selected( esc_attr( $selected_value ), esc_attr( $this->saved_value ) );
78 + // TODO: add hook that can add attributes to option text
79 + echo '>';
80 + echo esc_html( FrmAppHelper::truncate( $this->option_label, $truncate ) ) . '</option>';
84 81 }
85 -
86 - if ( $use_value_as_label && '' === trim( $this->option_label ) ) {
87 - $label = '' !== (string) $this->saved_value ? $this->saved_value : FrmAppHelper::get_no_label_text();
88 - } else {
89 - $label = $this->option_label;
90 - }
91 -
92 - echo '<option value="' . esc_attr( $this->saved_value ) . '"';
93 - selected( esc_attr( $selected_value ), esc_attr( $this->saved_value ) );
94 - // TODO: add hook that can add attributes to option text
95 - echo '>';
96 - echo esc_html( FrmAppHelper::truncate( $label, $truncate ) ) . '</option>';
97 82 }
98 83 }