ACF_Assets::print_footer_scripts
Prints scripts in footer.
Метод класса: ACF_Assets{}
Хуки из метода
Возвращает
null. Ничего (null).
Использование
$ACF_Assets = new ACF_Assets(); $ACF_Assets->print_footer_scripts();
Список изменений
| С версии 5.9.0 | Введена. |
Код ACF_Assets::print_footer_scripts() ACF Assets::print footer scripts ACF 6.4.2
public function print_footer_scripts() {
global $wp_version;
// Bail early if 'acf' script was never enqueued (fixes Elementor enqueue reset conflict).
if ( ! wp_script_is( 'acf' ) ) {
return;
}
// Localize data.
$data_to_localize = array(
'admin_url' => admin_url(),
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'acf_nonce' ),
'acf_version' => acf_get_setting( 'version' ),
'wp_version' => $wp_version,
'browser' => acf_get_browser(),
'locale' => acf_get_locale(),
'rtl' => is_rtl(),
'screen' => acf_get_form_data( 'screen' ),
'post_id' => acf_get_form_data( 'post_id' ),
'validation' => acf_get_form_data( 'validation' ),
'editor' => acf_is_block_editor() ? 'block' : 'classic',
'is_pro' => acf_is_pro(),
'debug' => acf_is_beta() || ( defined( 'ACF_DEVELOPMENT_MODE' ) && ACF_DEVELOPMENT_MODE ),
'StrictMode' => defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG && version_compare( $wp_version, '6.6', '>=' ),
);
acf_localize_data( $data_to_localize );
// Print inline script.
printf( "<script>\n%s\n</script>\n", 'acf.data = ' . wp_json_encode( $this->data ) . ';' );
if ( wp_script_is( 'acf-input' ) ) {
/**
* Filters an empty array for compat l10n data.
*
* @since 5.0.0
*
* @param array $data An array of data to append to.
*/
$compat_l10n = apply_filters( 'acf/input/admin_l10n', array() );
if ( $compat_l10n ) {
printf( "<script>\n%s\n</script>\n", 'acf.l10n = ' . wp_json_encode( $compat_l10n ) . ';' );
}
/**
* Fires during "admin_footer" when ACF scripts are enqueued.
*
* @since 5.6.9
*/
do_action( 'acf/input/admin_footer' );
do_action( 'acf/input/admin_print_footer_scripts' );
}
/**
* Fires during "admin_footer" when ACF scripts are enqueued.
*
* @since 5.6.9
*
* @param void
*/
do_action( 'acf/admin_footer' );
do_action( 'acf/admin_print_footer_scripts' );
// Once all data is localized, trigger acf.prepare() to execute functionality before DOM ready.
printf( "<script>\n%s\n</script>\n", "acf.doAction( 'prepare' );" );
}