| @@ -23,8 +23,9 @@ | ||
| 23 | 23 | protected $option; |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * @var string |
| 27 | + * | |
| 27 | 28 | * @since 2.03.05 |
| 28 | 29 | */ |
| 29 | 30 | protected $saved_value = ''; |
| 30 | 31 | |
| @@ -29,12 +30,20 @@ | ||
| 29 | 30 | protected $saved_value = ''; |
| 30 | 31 | |
| 31 | 32 | /** |
| 32 | 33 | * @var string |
| 34 | + * | |
| 33 | 35 | * @since 2.03.05 |
| 34 | 36 | */ |
| 35 | 37 | protected $option_label = ''; |
| 36 | 38 | |
| 39 | + /** | |
| 40 | + * @param int|string $option_key | |
| 41 | + * @param array|string $option | |
| 42 | + * @param array $args | |
| 43 | + * | |
| 44 | + * @return void | |
| 45 | + */ | |
| 37 | 46 | public function __construct( $option_key, $option, $args = array() ) { |
| 38 | 47 | $this->option_key = $option_key; |
| 39 | 48 | $this->option = $option; |
| 40 | 49 | $this->set_option_label(); |
| @@ -48,13 +57,9 @@ | ||
| 48 | 57 | * |
| 49 | 58 | * @return void |
| 50 | 59 | */ |
| 51 | 60 | private function set_option_label() { |
| 52 | - if ( is_array( $this->option ) ) { | |
| 53 | - $this->option_label = ( $this->option['label'] ?? reset( $this->option ) ); | |
| 54 | - } else { | |
| 55 | - $this->option_label = $this->option; | |
| 56 | - } | |
| 61 | + $this->option_label = is_array( $this->option ) ? ( $this->option['label'] ?? reset( $this->option ) ) : $this->option; | |
| 57 | 62 | } |
| 58 | 63 | |
| 59 | 64 | /** |
| 60 | 65 | * Set the saved value |
| @@ -83,9 +88,9 @@ | ||
| 83 | 88 | return; |
| 84 | 89 | } |
| 85 | 90 | |
| 86 | 91 | if ( $use_value_as_label && '' === trim( $this->option_label ) ) { |
| 87 | - $label = '' !== (string) $this->saved_value ? $this->saved_value : FrmAppHelper::get_no_label_text(); | |
| 92 | + $label = '' !== $this->saved_value ? $this->saved_value : FrmAppHelper::get_no_label_text(); | |
| 88 | 93 | } else { |
| 89 | 94 | $label = $this->option_label; |
| 90 | 95 | } |
| 91 | 96 | |