PluginProbe
Smart Grid-Layout Design for Contact Form 7 / 3.3.2
Smart Grid-Layout Design for Contact Form 7 v3.3.2
4.18.0 4.17.0 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 4.0.0 4.0.1 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10 4.11 4.12 4.13 4.14 All 119 releases
cf7-grid-layout / admin / partials / cf7-admin-editor-display.php

cf7-admin-editor-display.php in Smart Grid-Layout Design for Contact Form 7 3.3.2, at admin/partials/cf7-admin-editor-display.php

123 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Provide a admin area view for the plugin to edit contact form 7 through the visual editor
5 *
6 * This file is used to markup the admin-facing aspects of the plugin.
7 *
8 * @link http://syllogic.in
9 * @since 1.0.0
10 *
11 * @package Cf7_Grid_Layout
12 * @subpackage Cf7_Grid_Layout/admin/partials
13 */
14 $screen = get_current_screen();
15 ?>
16 <?php do_action( 'wpcf7_admin_warnings', 'wpcf7', wpcf7_current_action(), null ); ?>
17 <?php do_action( 'wpcf7_admin_notices' , 'wpcf7', wpcf7_current_action(), null ); ?>
18 <?php
19 if('add' == $screen->action) do_action( 'load-contact_page_wpcf7-new' );
20 else do_action( 'load-toplevel_page_wpcf7' );
21 ?>
22 <div id="cf7sg-editor">
23 <div style="position:relative">
24 <a id="full-screen-cf7" class="button" href="javascript:void(0)"><span><?= __('toggle full screen','cf7-grid-layout')?></span></a>
25 </div>
26 <input type="hidden" id="is-cf7sg-form" name="is_cf7sg_form" value="true" />
27 <input type="hidden" id="wpcf7-locale" name="wpcf7-locale" value="<?php echo esc_attr( $cf7_form->locale() ); ?>" />
28 <input type="hidden" id="active-tab" name="active-tab" value="<?php echo isset( $_GET['active-tab'] ) ? (int) $_GET['active-tab'] : '0'; ?>" />
29 <?php wp_nonce_field( 'wpcf7-save-contact-form_' . $post_id, '_wpcf7nonce' ); ?>
30
31 <div id="contact-form-editor">
32 <div class="keyboard-interaction"><?php echo sprintf( esc_html( __cf7sg( '%s keys switch panels') ), '<span class="dashicons dashicons-leftright"></span>' ); ?></div>
33
34 <?php
35
36 $editor = new WPCF7_Editor( $cf7_form );
37 $panels = array();
38
39 if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) {
40 $panels = array(
41 'form-panel' => array(
42 'title' => __cf7sg( 'Form' ),
43 'callback' => array($this, 'grid_editor_panel') ),
44 'mail-panel' => array(
45 'title' => __cf7sg( 'Mail' ),
46 'callback' => 'wpcf7_editor_panel_mail' ),
47 'messages-panel' => array(
48 'title' => __cf7sg( 'Messages' ),
49 'callback' => 'wpcf7_editor_panel_messages' ) );
50
51 $additional_settings = trim( $cf7_form->prop( 'additional_settings' ) );
52 $additional_settings = explode( "\n", $additional_settings );
53 $additional_settings = array_filter( $additional_settings );
54 $additional_settings = count( $additional_settings );
55
56 $panels['additional-settings-panel'] = array(
57 'title' => $additional_settings
58 ? sprintf(
59 __cf7sg( 'Additional Settings (%d)' ),
60 $additional_settings )
61 : __cf7sg( 'Additional Settings' ),
62 'callback' => 'wpcf7_editor_panel_additional_settings' );
63 }
64 /**
65 * filter to add/remove panels from the cf7 post editor
66 * @param array $panel aarray of panels presented as tabs in the editor, $id => array( 'title' => $panel_title, 'callback' => $callback_function). The $callback_function must be a valid function to echo the panel html script.
67 */
68 $panels = apply_filters( 'wpcf7_editor_panels', $panels );
69
70 foreach ( $panels as $id => $panel ) {
71 $editor->add_panel( $id, $panel['title'], $panel['callback'] );
72 }
73
74 $editor->display();
75 ?>
76 </div><!-- #contact-form-editor -->
77
78 <form action="" class="dummy-form" data-id="dummy">
79 <!-- DUMMY FORM to prevent some wp-core scripts from tempering with cf7 tags forms printed below-->
80 </form>
81 <?php
82
83 $tag_generator = WPCF7_TagGenerator::get_instance();
84
85 $tag_generator->print_panels( $cf7_form );
86
87 do_action( 'wpcf7_admin_footer', $cf7_form );
88
89 $dropdowns = get_option('_cf7sg_dynamic_dropdown_taxonomy',array());
90 $show_dropdown = array();
91 if( isset($dropdowns[$post_id]) ){
92 $show_dropdown = $dropdowns[$post_id];
93 }
94 ?>
95 <script type="text/javascript">
96 (function( $ ) {
97 'use strict';
98 //hide the taxonomy metabox not used on this page.
99 $(document).ready(function() {
100 <?php
101 $slugs = array();
102
103 foreach($dropdowns as $id => $all_lists){
104 //if($id == $post_id) continue;
105 foreach($all_lists as $slug => $taxonomy){
106 if(isset($slugs[$slug])){
107 continue;
108 }
109 if( $taxonomy['hierarchical'] ){
110 $hide_id = $slug.'div';
111 }else{
112 $hide_id = 'tagsdiv-'.$slug;
113 }
114
115 echo '$("#' . $hide_id . '").hide();'.PHP_EOL;
116 }
117 }
118 ?>
119 });
120 })( jQuery );
121 </script>
122 </div>
123