Skip to content

Conversation

@barthc
Copy link
Contributor

@barthc barthc commented Oct 25, 2024

Context

⛑️ Ticket(s): https://secure.helpscout.net/conversation/2738886758/72893

Depends on https://github.com/gravitywiz/gp-inventory/pull/111

Summary

Added a new snippet to enable WPML String Translate for custom Insufficient, Exhausted and Available Inventory messages.

@github-actions
Copy link

github-actions bot commented Oct 25, 2024

Warnings
⚠️ When ready, don't forget to request reviews on this pull request from your fellow wizards.

Generated by 🚫 dangerJS against 7cd677b

@barthc barthc force-pushed the barth/add/72893-wpml-translate branch from 9dbefb2 to 520386a Compare October 30, 2024 13:59
Copy link
Contributor

@claygriffiths claygriffiths left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff!

* https://gravitywiz.com/documentation/gravity-forms-inventory/
*/
add_action( 'init', function() {
if ( function_exists( 'icl_register_string' ) && function_exists( 'gp_inventory' ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To help reduce the number of indents, I'd do an early return if either of these functions doesn't exist

Comment on lines 9 to 10
$form_id = '26';
$form = GFAPI::get_form( $form_id );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a snippet people would want globally, so I'm thinking gform_pre_render may be a better option than init. That'd also allow you to remove these two variables.

@barthc barthc force-pushed the barth/add/72893-wpml-translate branch from 520386a to 404e744 Compare October 30, 2024 14:52
@barthc barthc force-pushed the barth/add/72893-wpml-translate branch from 404e744 to 7cd677b Compare November 1, 2024 07:22
@claygriffiths claygriffiths changed the title gpi-enable-wpml-for-custom-messages.php: Added snippet to use WPML String Translate for custom messages. gpi-enable-wpml-for-custom-messages.php: Added snippet to use WPML String Translate for custom GPI messages. Nov 4, 2024
@barthc barthc merged commit b7802b1 into master Nov 4, 2024
5 checks passed
@barthc barthc deleted the barth/add/72893-wpml-translate branch November 4, 2024 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants