/home/vianto5/cititower.mx/wp-content/plugins/wpml-wpforms/classes/Hooks/WpForms
NameSizeModeActions
AteFieldAdjuster.php63660644editdlrm
AteFieldReorder.php26880644editdlrm
AteLayoutHooks.php23770644editdlrm
ConversationalForms.php4020644editdlrm
DynamicChoices.php4360644editdlrm
EntryEdit.php16880644editdlrm
EntryPreviewField.php29390644editdlrm
Factory.php6070644editdlrm
FormPages.php16640644editdlrm
Import.php9080644editdlrm
Notifications.php95540644editdlrm
Package.php14450644editdlrm
Strings.php59040644editdlrm
SubLabels.php19830644editdlrm
TranslateEverythingHooks.php6300644editdlrm
Edit: /home/vianto5/cititower.mx/wp-content/plugins/wpml-wpforms/classes/Hooks/WpForms/SubLabels.php (1983B)
then( spreadArgs( [ $this, 'addFieldSubLabels' ] ) ); Hooks::onFilter( 'wpforms_field_properties_name', 10, 2 ) ->then( spreadArgs( [ $this, 'addSubLabelsTranslations' ] ) ); } /** * @param array $properties Field properties. * @param array $field Field data and settings. * * @return array */ public function addSubLabelsTranslations( array $properties, array $field ) : array { if ( $this->hasSubLabels( $field ) ) { foreach ( [ 'first' => 'first_label', 'middle' => 'middle_label', 'last' => 'last_label', ] as $key => $label ) { if ( Obj::prop( 'first_label', $field ) ) { $properties['inputs'][ $key ]['sublabel']['value'] = Obj::prop( $label, $field ); } } } return $properties; } /** * @param array $form * * @return array */ public function addFieldSubLabels( array $form ) : array { // Get a filtered form content. $formData = wpforms_decode( wp_unslash( $form['post_content'] ) ); $addSubLabels = function( array $field ) : array { if ( $this->hasSubLabels( $field ) ) { $field['first_label'] = Obj::propOr( __( 'First', 'wpforms-lite' ), 'first_label', $field ); $field['middle_label'] = Obj::propOr( __( 'Middle', 'wpforms-lite' ), 'middle_label', $field ); $field['last_label'] = Obj::propOr( __( 'Last', 'wpforms-lite' ), 'last_label', $field ); } return $field; }; $formData['fields'] = wpml_collect( $formData['fields'] ) ->map( $addSubLabels ) ->all(); return array_merge( $form, [ 'post_content' => wpforms_encode( $formData ) ] ); } /** * @param array $field * * @return bool */ private function hasSubLabels( array $field ) : bool { return 'name' === $field['type'] && 'simple' !== $field['format']; } }