Get the attributes in the “Dropdown” and “Single Line Text” fields
-
I want to translate all form fields into several languages. I used the following hook for the “Name” field:
function wpf_dev_name_field_properties( $properties, $field, $form_data ) { if ( absint( $form_data['id'] ) !== 755 ) { return $properties; } if ( get_locale() == 'ru_RU' ) { $properties['label']['value'] = 'Напишите свое имя'; $properties['inputs']['primary']['attr']['placeholder'] = 'Например: Станислав'; } elseif ( get_locale() == 'en_US' ) { $properties['label']['value'] = 'Enter your name'; $properties['inputs']['primary']['attr']['placeholder'] = 'For example: Stanislav'; } return $properties; } add_filter( 'wpforms_field_properties_name' , 'wpf_dev_name_field_properties', 10, 3 );
How can I similarly translate the “Placeholder” and “Label” attributes in the “Dropdown” and “Single Line Text” fields? Tried the “wpforms_field_properties” hook, but it does not have these fields in the $properties variable.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Get the attributes in the “Dropdown” and “Single Line Text” fields’ is closed to new replies.