wpcf7_admin_enqueue_scripts
The Contact Form 7 wpcf7 admin enqueue scripts function.
Description
wpcf7_admin_enqueue_scripts( $hook_suffix );
Parameters (1)
- 0. $hook_suffix
- The hook suffix.
Usage
if ( !function_exists( 'wpcf7_admin_enqueue_scripts' ) ) { require_once ABSPATH . PLUGINDIR . 'contact-form-7/admin/admin.php'; } // The hook suffix. $hook_suffix = null; // NOTICE! Understand what this does before running. $result = wpcf7_admin_enqueue_scripts($hook_suffix);
Defined (1)
The function is defined in the following location(s).
- /admin/admin.php
- function wpcf7_admin_enqueue_scripts( $hook_suffix ) {
- if ( false === strpos( $hook_suffix, wpcf7 ) ) {
- return;
- }
- wp_enqueue_style( 'contact-form-7-admin',
- wpcf7_plugin_url( 'admin/css/styles.css' ),
- array(), WPCF7_VERSION, 'all' );
- if ( wpcf7_is_rtl() ) {
- wp_enqueue_style( 'contact-form-7-admin-rtl',
- wpcf7_plugin_url( 'admin/css/styles-rtl.css' ),
- array(), WPCF7_VERSION, 'all' );
- }
- wp_enqueue_script( 'wpcf7-admin',
- wpcf7_plugin_url( 'admin/js/scripts.js' ),
- array( 'jquery', 'jquery-ui-tabs' ),
- WPCF7_VERSION, true );
- $args = array(
- 'apiSettings' => array(
- 'root' => esc_url_raw( get_rest_url() ),
- 'nonce' => ( wp_installing() && ! is_multisite() )
- ? '' : wp_create_nonce( 'wp_rest' ) ),
- 'pluginUrl' => wpcf7_plugin_url(),
- 'saveAlert' => __(
- "The changes you made will be lost if you navigate away from this page.",
- 'contact-form-7' ),
- 'activeTab' => isset( $_GET['active-tab'] )
- ? (int) $_GET['active-tab'] : 0,
- 'configValidator' => array(
- 'errors' => array(),
- 'howToCorrect' => __( "How to correct this?", 'contact-form-7' ),
- 'oneError' => __( '1 configurationerrordetected', 'contact-form-7' ),
- 'manyErrors' => __( '%d configuration errors detected', 'contact-form-7' ),
- 'oneErrorInTab' => __( '1 configurationerrordetected in this tab panel', 'contact-form-7' ),
- 'manyErrorsInTab' => __( '%d configuration errors detected in this tab panel', 'contact-form-7' ),
- 'docUrl' => WPCF7_ConfigValidator::get_doc_link(),
- ),
- );
- if ( ( $post = wpcf7_get_current_contact_form() )
- && current_user_can( 'wpcf7_edit_contact_form', $post->id() )
- && wpcf7_validate_configuration() ) {
- $config_validator = new WPCF7_ConfigValidator( $post );
- $config_validator->restore();
- $args['configValidator']['errors'] =
- $config_validator->collect_error_messages();
- }
- wp_localize_script( 'wpcf7-admin', '_wpcf7', $args );
- add_thickbox();
- wp_enqueue_script( 'wpcf7-admin-taggenerator',
- wpcf7_plugin_url( 'admin/js/tag-generator.js' ),
- array( 'jquery', 'thickbox', 'wpcf7-admin' ), WPCF7_VERSION, true );
- }