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: add missing form builder registrar dependencies for WP 6.4 compatibility #7028

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
}
],
"devDependencies": {
"@types/lodash": "^4.14.199",
"@types/react": "^18.0.27",
"@types/react-datepicker": "^4.15.0",
"@types/react-dom": "^18.0.10",
Expand Down
5 changes: 4 additions & 1 deletion src/FormBuilder/Routes/RegisterFormBuilderPageRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use Give\FormBuilder\FormBuilderRouteBuilder;
use Give\FormBuilder\ViewModels\FormBuilderViewModel;
use Give\Framework\Support\Facades\Scripts\ScriptAsset;
use Give\Framework\Views\View;
use Give\Helpers\Hooks;
use Give\Log\Log;
Expand Down Expand Up @@ -81,7 +82,9 @@ public function renderPage()
wp_enqueue_script(
'@givewp/form-builder/registrars',
$formBuilderViewModel->jsPathToRegistrars(),
[],
$this->getRegisteredFormBuilderJsDependencies(
$formBuilderViewModel->jsRegistrarsDependencies()
),
GIVE_VERSION,
true
);
Expand Down
13 changes: 11 additions & 2 deletions src/FormBuilder/ViewModels/FormBuilderViewModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Give\Framework\FormDesigns\FormDesign;
use Give\Framework\FormDesigns\Registrars\FormDesignRegistrar;
use Give\Framework\PaymentGateways\PaymentGateway;
use Give\Framework\Support\Facades\Scripts\ScriptAsset;
use Give\Subscriptions\Models\Subscription;

class FormBuilderViewModel
Expand Down Expand Up @@ -217,14 +218,22 @@ public function jsPathToRegistrars(): string
return GIVE_PLUGIN_URL . 'build/formBuilderRegistrars.js';
}

/**
* @since 3.0.0
*/
public function jsRegistrarsDependencies(): array
{
return ScriptAsset::getDependencies(GIVE_PLUGIN_DIR . 'build/formBuilderRegistrars.asset.php');
}

/**
* @since 3.0.0
*/
public function jsDependencies(): array
{
$scriptAsset = require GIVE_PLUGIN_DIR . 'build/formBuilderApp.asset.php';
$dependencies = ScriptAsset::getDependencies(GIVE_PLUGIN_DIR . 'build/formBuilderApp.asset.php');

return array_merge($scriptAsset['dependencies'], ['@givewp/form-builder/registrars']);
return array_merge($dependencies, ['@givewp/form-builder/registrars']);
}

/**
Expand Down
Loading