diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b9159f71..a9dbcd354 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/). +## [5.4.1] + +### Updated + +- Admin JS and CSS scripts are now loaded only on the forms page. + ## [5.4.0] ### Updated @@ -780,6 +786,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a - Initial production release. +[5.4.1]: https://github.com/infinum/eightshift-forms/compare/5.4.0...5.4.1 [5.4.0]: https://github.com/infinum/eightshift-forms/compare/5.3.2...5.4.0 [5.3.2]: https://github.com/infinum/eightshift-forms/compare/5.3.1...5.3.2 [5.3.1]: https://github.com/infinum/eightshift-forms/compare/5.3.0...5.3.1 diff --git a/eightshift-forms.php b/eightshift-forms.php index e9c55366f..dae722ef6 100644 --- a/eightshift-forms.php +++ b/eightshift-forms.php @@ -6,7 +6,7 @@ * Description: Eightshift Forms is a complete form builder plugin that utilizes modern Block editor features with multiple third-party integrations, bringing your project to a new level. * Author: WordPress team @Infinum * Author URI: https://eightshift.com/ - * Version: 5.4.0 + * Version: 5.4.1 * Text Domain: eightshift-forms * * @package EightshiftForms diff --git a/src/Enqueue/Admin/EnqueueAdmin.php b/src/Enqueue/Admin/EnqueueAdmin.php index 6f027ea21..ae00a32c7 100644 --- a/src/Enqueue/Admin/EnqueueAdmin.php +++ b/src/Enqueue/Admin/EnqueueAdmin.php @@ -36,6 +36,10 @@ class EnqueueAdmin extends AbstractEnqueueAdmin */ public function register(): void { + if (!UtilsGeneralHelper::isEightshiftFormsAdminPages()) { + return; + } + \add_action('admin_enqueue_scripts', [$this, 'enqueueStyles'], 50); \add_action('admin_enqueue_scripts', [$this, 'enqueueScripts']); } @@ -73,18 +77,16 @@ public function enqueueScripts(string $hook): void $output = []; - if (UtilsGeneralHelper::isEightshiftFormsAdminPages()) { - $output = \array_merge( - $this->getEnqueueSharedInlineCommonItems(false), - [ - 'nonce' => \wp_create_nonce('wp_rest'), - 'uploadConfirmMsg' => \__('Are you sure you want to contine?', 'eighshift-forms'), - 'importErrorMsg' => \__('There is an error with your data, please try again.', 'eighshift-forms'), - 'isAdmin' => true, - 'redirectionTimeout' => 100, - ], - ); - } + $output = \array_merge( + $this->getEnqueueSharedInlineCommonItems(false), + [ + 'nonce' => \wp_create_nonce('wp_rest'), + 'uploadConfirmMsg' => \__('Are you sure you want to contine?', 'eighshift-forms'), + 'importErrorMsg' => \__('There is an error with your data, please try again.', 'eighshift-forms'), + 'isAdmin' => true, + 'redirectionTimeout' => 100, + ], + ); $output = \wp_json_encode($output); \wp_add_inline_script($this->getAdminScriptHandle(), "const esFormsLocalization = {$output}", 'before');