Skip to content

Commit 1df01fe

Browse files
committed
Assets: remove redundant registrations, prefix registered scritps
1 parent 4def381 commit 1df01fe

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

includes/admin/admin-commands.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ function acf_commands_init() {
7575
'customPostTypes' => $custom_post_types,
7676
)
7777
);
78-
wp_enqueue_script( 'commands-custom-post-types' );
78+
wp_enqueue_script( 'scf-commands-custom-post-types' );
7979
}
8080

8181
// Only load admin commands if user has SCF admin capabilities.
8282
if ( current_user_can( acf_get_setting( 'capability' ) ) ) {
83-
wp_enqueue_script( 'commands-admin' );
83+
wp_enqueue_script( 'scf-commands-admin' );
8484
}
8585
}
8686

includes/assets.php

+4-12
Original file line numberDiff line numberDiff line change
@@ -243,17 +243,9 @@ public function register_scripts() {
243243
);
244244
}
245245

246-
// Register core scripts
247-
wp_register_script( 'acf', acf_get_url( 'assets/build/js/acf' . $suffix . '.js' ), array( 'jquery' ), $version, false );
248-
wp_register_script( 'acf-input', acf_get_url( 'assets/build/js/acf-input' . $suffix . '.js' ), array( 'jquery', 'jquery-ui-sortable', 'jquery-ui-resizable', 'acf', 'wp-a11y' ), $version, false );
249-
wp_register_script( 'acf-field-group', acf_get_url( 'assets/build/js/acf-field-group' . $suffix . '.js' ), array( 'acf-input' ), $version, false );
250-
wp_register_script( 'acf-internal-post-type', acf_get_url( 'assets/build/js/acf-internal-post-type' . $suffix . '.js' ), array( 'acf-input' ), $version, false );
251-
wp_register_script( 'acf-escaped-html-notice', acf_get_url( 'assets/build/js/acf-escaped-html-notice' . $suffix . '.js' ), array( 'jquery' ), $version, true );
252-
253-
// Register WordPress commands integration
254246
wp_register_script(
255-
'commands-admin',
256-
acf_get_url( 'assets/build/js/commands/admin' . $suffix . '.js' ),
247+
'scf-commands-admin',
248+
acf_get_url( 'assets/build/js/commands/scf-admin' . $suffix . '.js' ),
257249
array( 'acf', 'wp-plugins', 'wp-element', 'wp-components', 'wp-data', 'wp-commands', 'wp-i18n', 'wp-dom-ready' ),
258250
$version,
259251
array(
@@ -263,8 +255,8 @@ public function register_scripts() {
263255
);
264256

265257
wp_register_script(
266-
'commands-custom-post-types',
267-
acf_get_url( 'assets/build/js/commands/custom-post-types' . $suffix . '.js' ),
258+
'scf-commands-custom-post-types',
259+
acf_get_url( 'assets/build/js/commands/scf-custom-post-types' . $suffix . '.js' ),
268260
array( 'acf', 'wp-plugins', 'wp-element', 'wp-components', 'wp-data', 'wp-commands', 'wp-i18n', 'wp-dom-ready' ),
269261
$version,
270262
array(

webpack.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ const commonConfig = {
1515
'js/acf-input': './assets/src/js/acf-input.js',
1616
'js/acf-internal-post-type':
1717
'./assets/src/js/acf-internal-post-type.js',
18-
'js/commands/admin': './assets/src/js/commands/admin-commands.js',
19-
'js/commands/custom-post-types': './assets/src/js/commands/custom-post-type-commands.js',
18+
'js/commands/scf-admin': './assets/src/js/commands/admin-commands.js',
19+
'js/commands/scf-custom-post-types': './assets/src/js/commands/custom-post-type-commands.js',
2020
'js/acf': './assets/src/js/acf.js',
2121
'js/pro/acf-pro-blocks': './assets/src/js/pro/acf-pro-blocks.js',
2222
'js/pro/acf-pro-field-group':

0 commit comments

Comments
 (0)