Enqueue Parsley translation strings in after "admin_vendor"

This is a better place and it corresponds to the current logic.

[MAILPOET-5118]
This commit is contained in:
Jan Jakes
2023-10-02 14:38:00 +02:00
committed by Aschepikov
parent 16c51717b7
commit 0411ed2c37

View File

@@ -84,9 +84,6 @@ class AssetsController {
true
);
$this->wp->wpSetScriptTranslations($name, 'mailpoet');
// append Parsley validation string translations
$this->wp->wpAddInlineScript($name, $this->renderer->render('parsley-translations.html'));
}
private function registerAdminDeps(): void {
@@ -117,6 +114,9 @@ class AssetsController {
]
);
// append Parsley validation string translations
$this->wp->wpAddInlineScript('mailpoet_admin_vendor', $this->renderer->render('parsley-translations.html'));
// enqueue "mailpoet_admin_vendor" so the hook fires after it, but before "mailpoet_admin"
$this->wp->wpEnqueueScript('mailpoet_admin_vendor');
if ($this->wp->didAction('mailpoet_scripts_admin_before') === 0) {