| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * A prototype to allow inline editing / editor views for contact forms.\ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * Originally developed in: http://github.com/automattic/gm2016-grunion-editor | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * Authors: Michael Arestad, Andrew Ozz, and George Stephanis | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 10 |  |  | class Grunion_Editor_View { | 
            
                                                                        
                            
            
                                    
            
            
                | 11 |  |  | 	public static function add_hooks() { | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  | 		add_action( 'admin_notices', array( __CLASS__, 'handle_editor_view_js' ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  | 		add_filter( 'mce_external_plugins', array( __CLASS__, 'mce_external_plugins' ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  | 		add_filter( 'mce_buttons', array( __CLASS__, 'mce_buttons' ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  | 		add_action( 'admin_head', array( __CLASS__, 'admin_head' ) ); | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | 	public static function admin_head() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | 		remove_action( 'media_buttons', 'grunion_media_button', 999 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | 	public static function mce_external_plugins( $plugin_array ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | 		$plugin_array['grunion_form'] =  plugins_url( 'js/tinymce-plugin-form-button.js', __FILE__ ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | 		return $plugin_array; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 	public static function mce_buttons( $buttons ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | 		$size = sizeof( $buttons ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | 		$buttons1 = array_slice( $buttons, 0, $size - 1 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 		$buttons2 = array_slice( $buttons, $size - 1 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 		return array_merge( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 			$buttons1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 			array( 'grunion' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 			$buttons2 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 	 * WordPress Shortcode Editor View JS Code | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 	public static function handle_editor_view_js() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 		$current_screen = get_current_screen(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 		if ( ! isset( $current_screen->id ) || $current_screen->base !== 'post' ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 			return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | 		add_action( 'admin_print_footer_scripts', array( __CLASS__, 'editor_view_js_templates' ), 1 ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 		wp_enqueue_style( 'grunion-editor-ui', plugins_url( 'css/editor-ui.css', __FILE__ ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | 		wp_enqueue_script( 'grunion-editor-view', plugins_url( 'js/editor-view.js', __FILE__ ), array( 'wp-util', 'jquery', 'quicktags' ), false, true ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 		wp_localize_script( 'grunion-editor-view', 'grunionEditorView', array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 			'inline_editing_style' => plugins_url( 'css/editor-inline-editing-style.css', __FILE__ ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 			'dashicons_css_url'    => includes_url( 'css/dashicons.css' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 			'default_form'  => '[contact-field label="' . __( 'Name', 'jetpack' ) . '" type="name"  required="true" /]' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 								'[contact-field label="' . __( 'Email', 'jetpack' )   . '" type="email" required="true" /]' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 								'[contact-field label="' . __( 'Website', 'jetpack' ) . '" type="url" /]' . | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 								'[contact-field label="' . __( 'Message', 'jetpack' ) . '" type="textarea" /]', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 			'labels'      => array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 				'submit_button_text'  => __( 'Submit', 'jetpack' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 				'required_field_text' => apply_filters( 'jetpack_required_field_text', __( '(required)', 'jetpack' ) ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 				'edit_close_ays'      => __( 'Are you sure you\'d like to stop editing this form without saving your changes?', 'jetpack' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 				'quicktags_label'     => __( 'contact form', 'jetpack' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  | 				'tinymce_label'       => __( 'Add contact form', 'jetpack' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  | 			) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 		) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  | 		add_editor_style( plugins_url( 'css/editor-style.css', __FILE__ ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 	 * JS Templates. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  | 	public static function editor_view_js_templates() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | 		?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | <script type="text/html" id="tmpl-grunion-contact-form"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | 	<form class="card" action='#' method='post' class='contact-form commentsblock' onsubmit="return false;"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 		{{{ data.body }}} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | 		<p class='contact-submit'> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 			<input type='submit' value='{{ data.submit_button_text }}' class='pushbutton-wide'/> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  | 		</p> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 	</form> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  | <script type="text/html" id="tmpl-grunion-field-email"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  | 	<div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 		<label for='{{ data.id }}' class='grunion-field-label email'>{{ data.label }}<# if ( data.required ) print( " <span>" + data.required + "</span>" ) #></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 		<input type='email' name='{{ data.id }}' id='{{ data.id }}' value='{{ data.value }}' class='{{ data.class }}' placeholder='{{ data.placeholder }}' /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  | 	</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  | </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  | <script type="text/html" id="tmpl-grunion-field-telephone"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  | 	<div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  | 		<label for='{{ data.id }}' class='grunion-field-label telephone'>{{ data.label }}<# if ( data.required ) print( " <span>" + data.required + "</span>" ) #></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  | 		<input type='tel' name='{{ data.id }}' id='{{ data.id }}' value='{{ data.value }}' class='{{ data.class }}' placeholder='{{ data.placeholder }}' /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  | 	</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  | </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  | <script type="text/html" id="tmpl-grunion-field-textarea"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | 	<div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  | 		<label for='contact-form-comment-{{ data.id }}' class='grunion-field-label textarea'>{{ data.label }}<# if ( data.required ) print( " <span>" + data.required + "</span>" ) #></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  | 		<textarea name='{{ data.id }}' id='contact-form-comment-{{ data.id }}' rows='20' class='{{ data.class }}' placeholder='{{ data.placeholder }}'>{{ data.value }}</textarea> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  | 	</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  | </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  | <script type="text/html" id="tmpl-grunion-field-radio"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  | 	<div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  | 		<label class='grunion-field-label'>{{ data.label }}<# if ( data.required ) print( " <span>" + data.required + "</span>" ) #></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  | 		<# _.each( data.options, function( option ) { #> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  | 			<label class='grunion-radio-label radio'> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  | 				<input type='radio' name='{{ data.id }}' value='{{ option }}' class="{{ data.class }}" <# if ( option === data.value ) print( "checked='checked'" ) #> /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | 				<span>{{ option }}</span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  | 			</label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  | 		<# }); #> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  | 		<div class='clear-form'></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  | 	</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  | </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  | <script type="text/html" id="tmpl-grunion-field-checkbox"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  | 	<div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  | 		<label class='grunion-field-label checkbox'> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  | 			<input type='checkbox' name='{{ data.id }}' value='<?php esc_attr__( 'Yes', 'jetpack' ); ?>' class="{{ data.class }}" <# if ( data.value ) print( 'checked="checked"' ) #> /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  | 				<span>{{ data.label }}</span><# if ( data.required ) print( " <span>" + data.required + "</span>" ) #> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  | 		</label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  | 		<div class='clear-form'></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  | 	</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  | </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  | <script type="text/html" id="tmpl-grunion-field-checkbox-multiple"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  | 	<div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  | 		<label class='grunion-field-label'>{{ data.label }}<# if ( data.required ) print( " <span>" + data.required + "</span>" ) #></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  | 		<# _.each( data.options, function( option ) { #> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  | 			<label class='grunion-checkbox-multiple-label checkbox-multiple'> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  | 				<input type='checkbox' name='{{ data.id }}[]' value='{{ option }}' class="{{ data.class }}" <# if ( option === data.value || _.contains( data.value, option ) ) print( "checked='checked'" ) #> /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  | 				<span>{{ option }}</span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  | 			</label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  | 		<# }); #> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  | 		<div class='clear-form'></div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  | 	</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  | </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  | <script type="text/html" id="tmpl-grunion-field-select"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  | 	<div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  | 		<label for='{{ data.id }}' class='grunion-field-label select'>{{ data.label }}<# if ( data.required ) print( " <span>" + data.required + "</span>" ) #></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  | 		<select name='{{ data.id }}' id='{{ data.id }}' class="{{ data.class }}"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  | 			<# _.each( data.options, function( option ) { #> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | 				<option <# if ( option === data.value ) print( "selected='selected'" ) #>>{{ option }}</option> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  | 			<# }); #> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  | 		</select> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | 	</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  | </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  | <script type="text/html" id="tmpl-grunion-field-date"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  | 	<div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  | 		<label for='{{ data.id }}' class='grunion-field-label {{ data.type }}'>{{ data.label }}<# if ( data.required ) print( " <span>" + data.required + "</span>" ) #></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  | 		<input type='date' name='{{ data.id }}' id='{{ data.id }}' value='{{ data.value }}' class="{{ data.class }}" /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  | 	</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  | </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  | <script type="text/html" id="tmpl-grunion-field-text"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  | 	<div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  | 		<label for='{{ data.id }}' class='grunion-field-label {{ data.type }}'>{{ data.label }}<# if ( data.required ) print( " <span>" + data.required + "</span>" ) #></label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  | 		<input type='text' name='{{ data.id }}' id='{{ data.id }}' value='{{ data.value }}' class='{{ data.class }}' placeholder='{{ data.placeholder }}' /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  | 	</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  | </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | <script type="text/html" id="tmpl-grunion-field-edit"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  | 	<div class="card is-compact grunion-field-edit grunion-field-{{ data.type }}" aria-label="<?php esc_attr_e( 'Form Field', 'jetpack' ); ?>"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  | 		<label class="grunion-name"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  | 			<span><?php esc_html_e( 'Field Label', 'jetpack' ); ?></span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  | 			<input type="text" name="label" placeholder="<?php esc_attr_e( 'Label', 'jetpack' ); ?>" value="{{ data.label }}"/> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  | 		</label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  | 		<?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  | 		$grunion_field_types = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  | 			'text'              => __( 'Text', 'jetpack' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  | 			'name'              => __( 'Name', 'jetpack' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  | 			'email'             => __( 'Email', 'jetpack' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  | 			'url'               => __( 'Website', 'jetpack' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  | 			'textarea'          => __( 'Textarea', 'jetpack' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  | 			'checkbox'          => __( 'Checkbox', 'jetpack' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  | 			'checkbox-multiple' => __( 'Checkbox with Multiple Items', 'jetpack' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  | 			'select'            => __( 'Drop down', 'jetpack' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  | 			'radio'             => __( 'Radio', 'jetpack' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | 		); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | 		?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  | 		<label class="grunion-type"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  | 			<?php esc_html_e( 'Field Type', 'jetpack' ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  | 			<select name="type"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  | 				<?php foreach ( $grunion_field_types as $type => $label ) : ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  | 				<option <# if ( '<?php echo esc_js( $type ); ?>' === data.type ) print( "selected='selected'" ) #> value="<?php echo esc_attr( $type ); ?>"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  | 					<?php echo esc_html( $label ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  | 				</option> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  | 				<?php endforeach; ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  | 			</select> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  | 		</label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  | 		<label class="grunion-required"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  | 			<input type="checkbox" name="required" value="1" <# if ( data.required ) print( 'checked="checked"' ) #> /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | 			<span><?php esc_html_e( 'Required?', 'jetpack' ); ?></span> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  | 		</label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | 		<label class="grunion-options"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  | 			<?php esc_html_e( 'Options', 'jetpack' ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  | 			<ol> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  | 				<# if ( data.options ) { #> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  | 					<# _.each( data.options, function( option ) { #> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  | 						<li><input type="text" name="option" value="{{ option }}" /> <a class="delete-option" href="javascript:;"><span class="screen-reader-text"><?php esc_html_e( 'Delete Option', 'jetpack' ); ?></span></a></li> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  | 					<# }); #> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  | 				<# } else { #> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  | 					<li><input type="text" name="option" /> <a class="delete-option" href="javascript:;"><span class="screen-reader-text"><?php esc_html_e( 'Delete Option', 'jetpack' ); ?></span></a></li> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  | 					<li><input type="text" name="option" /> <a class="delete-option" href="javascript:;"><span class="screen-reader-text"><?php esc_html_e( 'Delete Option', 'jetpack' ); ?></span></a></li> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  | 					<li><input type="text" name="option" /> <a class="delete-option" href="javascript:;"><span class="screen-reader-text"><?php esc_html_e( 'Delete Option', 'jetpack' ); ?></span></a></li> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  | 				<# } #> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  | 				<li><a class="add-option" href="javascript:;"><?php esc_html_e( 'Add new option...', 'jetpack' ); ?></a></li> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  | 			</ol> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  | 		</label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  | 		<a href="javascript:;" class="delete-field"><span class="screen-reader-text"><?php esc_html_e( 'Delete Field', 'jetpack' ); ?></span></a> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  | 	</div> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  | </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  | <script type="text/html" id="tmpl-grunion-field-edit-option"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  | 	<li><input type="text" name="option" /> <a class="delete-option" href="javascript:;"><span class="screen-reader-text"><?php esc_html_e( 'Delete Option', 'jetpack' ); ?></span></a></li> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  | </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  | <script type="text/html" id="tmpl-grunion-editor-inline"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  | 			<h1 id="form-settings-header" class="grunion-section-header"><?php esc_html_e( 'Form Settings', 'jetpack' ); ?></h1> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  | 			<section class="card grunion-form-settings" aria-labelledby="form-settings-header"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  | 				<label><?php esc_html_e( 'What would you like the subject of the email to be?', 'jetpack' ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  | 					<input type="text" name="subject" value="{{ data.subject }}" /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  | 				</label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  | 				<label><?php esc_html_e( 'Which email address should we send the submissions to?', 'jetpack' ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  | 					<input type="text" name="to" value="{{ data.to }}" /> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  | 				</label> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  | 			</section> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  | 			<h1 id="form-fields-header" class="grunion-section-header"><?php esc_html_e( 'Form Fields', 'jetpack' ); ?></h1> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  | 			<section class="grunion-fields" aria-labelledby="form-fields-header"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  | 				{{{ data.fields }}} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  | 			</section> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  | 			<section class="buttons"> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  | 				<?php submit_button( esc_html__( 'Add Field', 'jetpack' ), 'secondary', 'add-field', false ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  | 				<?php submit_button( esc_html__( 'Update Form', 'jetpack' ), 'primary', 'submit', false ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  | 				<?php submit_button( esc_html__( 'Cancel', 'jetpack' ), 'delete', 'cancel', false ); ?> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  | 			</section> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  | </script> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  | 	<?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 252 |  |  | Grunion_Editor_View::add_hooks(); | 
            
                                                        
            
                                    
            
            
                | 253 |  |  |  |