Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/translation error in blocks #986

Merged
merged 6 commits into from
Jan 20, 2025
Merged

Conversation

mmaymo
Copy link
Collaborator

@mmaymo mmaymo commented Jan 20, 2025

This PR solves an issue where the Mollie methods in blocks appeared as non compatible. This was due to the change in the init hook. Now we are back to the plugins_loaded hook. To avoid the translations called too early issue the payment fields were moved to a later hook after_setup_theme

@mmaymo mmaymo requested a review from danielhuesken January 20, 2025 08:05
Copy link
Collaborator

@danielhuesken danielhuesken left a comment

Choose a reason for hiding this comment

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

I think there must be other ways to do it

// Load the settings.
$this->init_form_fields();
// Load the settings when translations are ready
add_action('after_setup_theme', [$this, 'init_form_fields']);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not on init ?

@@ -61,6 +65,8 @@ public function __construct(
$this->config = $this->getConfig();
$this->settings = $this->getSettings();
$this->apiPaymentMethod = $apiPaymentMethod;
add_action('after_setup_theme', [$this, 'initializeTranslations']);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think better is to use init

src/PaymentMethods/Applepay.php Show resolved Hide resolved
The label was moved to a hook so we need to init it in test
@mmaymo mmaymo merged commit 2e68334 into develop Jan 20, 2025
5 checks passed
@mmaymo mmaymo deleted the fix/translation-error-in-blocks branch January 20, 2025 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants