public function gform_pre_render( $form ) {<br />return $this->translate( $form );<br />}
3. Replace the existing code with the following to preserve specific form data:
public function gform_pre_render( $form ) {<br />// Preserve the page_instance key if it exists<br />$page_instance = isset( $form['page_instance'] ) ? $form['page_instance'] : null;<br /><br />// Translate the form<br />$form = $this->translate( $form );<br /><br />// Reassign the page_instance key after translation<br />if ( $page_instance !== null ) {<br />$form['page_instance'] = $page_instance;<br />}<br /><br />return $form;<br />}
Please check if this modification resolves the issue on your site.
Keep in mind that this solution might be outdated or not applicable to your specific case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Background of the issue:
I am trying to fix an issue with the GravityForms styling when the GravityForms MultiLingual plugin is active. In the file gravityforms-multilingual/inc/gravity-forms-multilingual.class.php, there is a filter being added: add_filter( 'gform_pre_render', [ $this, 'gform_pre_render' ] );. The gform_pre_render makes a single call to return $this->translate( $form );. However, something in that function breaks the wrapper of the GravityForm. It removes the data-form-index="0" attribute somehow, causing the inline CSS to be disregarded. Commenting out that filter brings back the data-index attribute, and thus fixes the styling. Link to a page where the issue can be seen: hidden link
Symptoms:
The GravityForms lose styling when the GravityForms MultiLingual plugin is active. The data-form-index="0" attribute is removed, causing the inline CSS to be disregarded.
Questions:
Why does the gform_pre_render function remove the data-form-index attribute?
How can I fix the styling issue without commenting out the filter?
Thanks for the reply! I recreated the issue in the sandbox. If you visit the sample page at hidden link, the form wrapper is also missing the data-form-index="0" attribute and thus my styling is lost. If I deactivate the GravityFroms Multilingual plugin, the attribute (and the styling) is back -- in this case, styling refers simply to the background color of the submit button.