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

  1. if ( !function_exists( 'wpcf7_admin_enqueue_scripts' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/admin/admin.php'; 
  3.  
  4. // The hook suffix. 
  5. $hook_suffix = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpcf7_admin_enqueue_scripts($hook_suffix); 
  9.  

Defined (1)

The function is defined in the following location(s).

/admin/admin.php  
  1. function wpcf7_admin_enqueue_scripts( $hook_suffix ) { 
  2. if ( false === strpos( $hook_suffix, wpcf7 ) ) { 
  3. return; 
  4.  
  5. wp_enqueue_style( 'contact-form-7-admin',  
  6. wpcf7_plugin_url( 'admin/css/styles.css' ),  
  7. array(), WPCF7_VERSION, 'all' ); 
  8.  
  9. if ( wpcf7_is_rtl() ) { 
  10. wp_enqueue_style( 'contact-form-7-admin-rtl',  
  11. wpcf7_plugin_url( 'admin/css/styles-rtl.css' ),  
  12. array(), WPCF7_VERSION, 'all' ); 
  13.  
  14. wp_enqueue_script( 'wpcf7-admin',  
  15. wpcf7_plugin_url( 'admin/js/scripts.js' ),  
  16. array( 'jquery', 'jquery-ui-tabs' ),  
  17. WPCF7_VERSION, true ); 
  18.  
  19. $args = array( 
  20. 'apiSettings' => array( 
  21. 'root' => esc_url_raw( get_rest_url() ),  
  22. 'nonce' => ( wp_installing() && ! is_multisite() ) 
  23. ? '' : wp_create_nonce( 'wp_rest' ) ),  
  24. 'pluginUrl' => wpcf7_plugin_url(),  
  25. 'saveAlert' => __( 
  26. "The changes you made will be lost if you navigate away from this page.",  
  27. 'contact-form-7' ),  
  28. 'activeTab' => isset( $_GET['active-tab'] ) 
  29. ? (int) $_GET['active-tab'] : 0,  
  30. 'configValidator' => array( 
  31. 'errors' => array(),  
  32. 'howToCorrect' => __( "How to correct this?", 'contact-form-7' ),  
  33. 'oneError' => __( '1 configurationerrordetected', 'contact-form-7' ),  
  34. 'manyErrors' => __( '%d configuration errors detected', 'contact-form-7' ),  
  35. 'oneErrorInTab' => __( '1 configurationerrordetected in this tab panel', 'contact-form-7' ),  
  36. 'manyErrorsInTab' => __( '%d configuration errors detected in this tab panel', 'contact-form-7' ),  
  37. 'docUrl' => WPCF7_ConfigValidator::get_doc_link(),  
  38. ),  
  39. ); 
  40.  
  41. if ( ( $post = wpcf7_get_current_contact_form() ) 
  42. && current_user_can( 'wpcf7_edit_contact_form', $post->id() ) 
  43. $config_validator = new WPCF7_ConfigValidator( $post ); 
  44. $config_validator->restore(); 
  45. $args['configValidator']['errors'] = 
  46. $config_validator->collect_error_messages(); 
  47.  
  48. wp_localize_script( 'wpcf7-admin', '_wpcf7', $args ); 
  49.  
  50. add_thickbox(); 
  51.  
  52. wp_enqueue_script( 'wpcf7-admin-taggenerator',  
  53. wpcf7_plugin_url( 'admin/js/tag-generator.js' ),  
  54. array( 'jquery', 'thickbox', 'wpcf7-admin' ), WPCF7_VERSION, true );