| @@ -27,20 +27,16 @@ | ||
| 27 | 27 | * @since 3.0 |
| 28 | 28 | */ |
| 29 | 29 | protected $holds_email_values = true; |
| 30 | 30 | |
| 31 | - /** | |
| 32 | - * @param array|int|object $field | |
| 33 | - * @param string $type | |
| 34 | - */ | |
| 35 | - public function __construct( $field = 0, $type = '' ) { | |
| 31 | + public function __construct( $field = '', $type = '' ) { | |
| 36 | 32 | parent::__construct( $field, $type ); |
| 37 | 33 | |
| 38 | 34 | $this->register_sub_fields( |
| 39 | 35 | array( |
| 40 | - 'first' => __( 'First Name', 'formidable' ), | |
| 41 | - 'middle' => __( 'Middle Name', 'formidable' ), | |
| 42 | - 'last' => __( 'Last Name', 'formidable' ), | |
| 36 | + 'first' => __( 'First', 'formidable' ), | |
| 37 | + 'middle' => __( 'Middle', 'formidable' ), | |
| 38 | + 'last' => __( 'Last', 'formidable' ), | |
| 43 | 39 | ) |
| 44 | 40 | ); |
| 45 | 41 | } |
| 46 | 42 | |
| @@ -112,10 +108,8 @@ | ||
| 112 | 108 | * |
| 113 | 109 | * @since 4.0 |
| 114 | 110 | * |
| 115 | 111 | * @param array $args Includes 'field', 'display', and 'values'. |
| 116 | - * | |
| 117 | - * @return void | |
| 118 | 112 | */ |
| 119 | 113 | public function show_primary_options( $args ) { |
| 120 | 114 | $field = (array) $args['field']; |
| 121 | 115 | include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/name/primary-options.php'; |
| @@ -138,9 +132,9 @@ | ||
| 138 | 132 | |
| 139 | 133 | $name_layout = $this->get_name_layout(); |
| 140 | 134 | |
| 141 | 135 | if ( ! empty( $atts['show'] ) ) { |
| 142 | - return $value[ $atts['show'] ] ?? ''; | |
| 136 | + return isset( $value[ $atts['show'] ] ) ? $value[ $atts['show'] ] : ''; | |
| 143 | 137 | } |
| 144 | 138 | |
| 145 | 139 | $value = wp_parse_args( |
| 146 | 140 | $value, |
| @@ -168,10 +162,8 @@ | ||
| 168 | 162 | } |
| 169 | 163 | |
| 170 | 164 | /** |
| 171 | 165 | * @since 4.0.04 |
| 172 | - * | |
| 173 | - * @return void | |
| 174 | 166 | */ |
| 175 | 167 | public function sanitize_value( &$value ) { |
| 176 | 168 | FrmAppHelper::sanitize_value( 'sanitize_text_field', $value ); |
| 177 | 169 | } |
| @@ -203,10 +195,8 @@ | ||
| 203 | 195 | * @type array $shortcode_atts Shortcode attributes. |
| 204 | 196 | * @type array $errors Field errors. |
| 205 | 197 | * @type bool $remove_names Remove name attribute or not. |
| 206 | 198 | * } |
| 207 | - * | |
| 208 | - * @return void | |
| 209 | 199 | */ |
| 210 | 200 | protected function process_args_for_field_output( &$args ) { |
| 211 | 201 | parent::process_args_for_field_output( $args ); |
| 212 | 202 | |
| @@ -240,49 +230,6 @@ | ||
| 240 | 230 | $attrs = parent::get_inputs_container_attrs(); |
| 241 | 231 | |
| 242 | 232 | $attrs['data-name-layout'] = $this->get_name_layout(); |
| 243 | 233 | return $attrs; |
| 244 | - } | |
| 245 | - | |
| 246 | - /** | |
| 247 | - * Maybe show a warning if a name field is using a description that is not descriptive enough. | |
| 248 | - * Prior to version 6.16, First and Last were the default values, but this has been updated to | |
| 249 | - * improve accessibility. | |
| 250 | - * | |
| 251 | - * @since 6.16 | |
| 252 | - * | |
| 253 | - * @param array $args | |
| 254 | - * @return void | |
| 255 | - */ | |
| 256 | - public function show_after_default( $args ) { | |
| 257 | - echo '<div class="frm-mt-xs">'; | |
| 258 | - parent::show_after_default( $args ); | |
| 259 | - echo '</div>'; | |
| 260 | - | |
| 261 | - /** | |
| 262 | - * @var array $field | |
| 263 | - */ | |
| 264 | - $field = $args['field']; | |
| 265 | - | |
| 266 | - $show_warning = false; | |
| 267 | - foreach ( $this->sub_fields as $name => $sub_field ) { | |
| 268 | - $description = FrmField::get_option( $field, $sub_field['name'] . '_desc' ); | |
| 269 | - if ( in_array( $description, array( 'First', 'Last' ), true ) ) { | |
| 270 | - $show_warning = true; | |
| 271 | - break; | |
| 272 | - } | |
| 273 | - } | |
| 274 | - | |
| 275 | - if ( ! $show_warning ) { | |
| 276 | - return; | |
| 277 | - } | |
| 278 | - ?> | |
| 279 | - <div class="frm_warning_style"> | |
| 280 | - <?php | |
| 281 | - FrmAppHelper::icon_by_class( 'frm_icon_font frm_alert_icon', array( 'style' => 'width:24px' ) ); | |
| 282 | - echo ' '; | |
| 283 | - esc_html_e( 'Subfield descriptions are read by screen readers. Enhance accessibility by using complete labels, like "First Name" instead of "First".', 'formidable' ); | |
| 284 | - ?> | |
| 285 | - </div> | |
| 286 | - <?php | |
| 287 | 234 | } |
| 288 | 235 | } |