PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 1.9.7.7
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v1.9.7.7
3.4.6 3.4.5 3.4.4 3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 All 199 releases
convertkit / views / backend / tinymce / modal-field.php

modal-field.php in Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages 1.9.7.7, at views/backend/tinymce/modal-field.php

138 lines 4.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * TinyMCE Modal Field view
4 *
5 * @package ConvertKit
6 * @author ConvertKit
7 */
8
9 // Build a string of data- attributes.
10 $data_attributes = '';
11 $data_attributes_shortcode_defined = false;
12 if ( isset( $field['data'] ) ) {
13 foreach ( $field['data'] as $data_attribute => $data_attribute_value ) {
14 $data_attributes .= ' data-' . $data_attribute . '="' . $data_attribute_value . '"';
15
16 if ( $data_attribute === 'shortcode' ) {
17 $data_attributes_shortcode_defined = true;
18 }
19 }
20 }
21 if ( ! $data_attributes_shortcode_defined ) {
22 $data_attributes .= ' data-shortcode="' . $field_name . '"';
23 }
24
25 switch ( $field['type'] ) {
26
27 /**
28 * Text
29 */
30 case 'text':
31 case 'text_multiple':
32 ?>
33 <input type="text"
34 id="tinymce_modal_<?php echo esc_attr( $field_name ); ?>"
35 name="<?php echo esc_attr( $field_name ); ?>"
36 value="<?php echo esc_attr( isset( $shortcode['attributes'][ $field_name ]['default'] ) ? $shortcode['attributes'][ $field_name ]['default'] : '' ); ?>"
37 <?php echo $data_attributes; // phpcs:ignore ?>
38 placeholder="<?php echo esc_attr( isset( $field['placeholder'] ) ? $field['placeholder'] : '' ); ?>"
39 class="widefat <?php echo esc_attr( isset( $field['class'] ) ? $field['class'] : '' ); ?>" />
40 <?php
41 break;
42
43 /**
44 * Number
45 */
46 case 'number':
47 ?>
48 <input type="number"
49 id="tinymce_modal_<?php echo esc_attr( $field_name ); ?>"
50 name="<?php echo esc_attr( $field_name ); ?>"
51 value="<?php echo esc_attr( isset( $shortcode['attributes'][ $field_name ]['default'] ) ? $shortcode['attributes'][ $field_name ]['default'] : '' ); ?>"
52 <?php echo $data_attributes; // phpcs:ignore ?>
53 min="<?php echo esc_attr( $field['min'] ); ?>"
54 max="<?php echo esc_attr( $field['max'] ); ?>"
55 step="<?php echo esc_attr( $field['step'] ); ?>"
56 class="widefat <?php echo esc_attr( isset( $field['class'] ) ? $field['class'] : '' ); ?>" />
57 <?php
58 break;
59
60 /**
61 * Select
62 */
63 case 'select':
64 ?>
65 <select name="<?php echo esc_attr( $field_name ); ?>"
66 id="tinymce_modal_<?php echo esc_attr( $field_name ); ?>"
67 <?php echo $data_attributes; // phpcs:ignore ?>
68 size="1"
69 class="widefat <?php echo esc_attr( isset( $field['class'] ) ? $field['class'] : '' ); ?>">
70 <?php
71 $field['default_value'] = ( isset( $shortcode['attributes'][ $field_name ]['default'] ) ? $shortcode['attributes'][ $field_name ]['default'] : '' );
72 foreach ( $field['values'] as $value => $label ) {
73 ?>
74 <option value="<?php echo esc_attr( $value ); ?>"<?php selected( $field['default_value'], $value ); ?>>
75 <?php echo esc_attr( $label ); ?>
76 </option>
77 <?php
78 }
79 ?>
80 </select>
81 <?php
82 break;
83
84 /**
85 * Multiple Select
86 */
87 case 'select_multiple':
88 ?>
89 <select name="<?php echo esc_attr( $field_name ); ?>[]"
90 id="tinymce_modal_<?php echo esc_attr( $field_name ); ?>"
91 <?php echo $data_attributes; // phpcs:ignore ?>
92 size="1"
93 multiple="multiple"
94 class="widefat <?php echo esc_attr( isset( $field['class'] ) ? $field['class'] : '' ); ?>">
95 <?php
96 $field['default_value'] = ( isset( $shortcode['attributes'][ $field_name ]['default'] ) ? $shortcode['attributes'][ $field_name ]['default'] : '' );
97 if ( isset( $field['values'] ) && is_array( $field['values'] ) && count( $field['values'] ) > 0 ) {
98 foreach ( $field['values'] as $value => $label ) {
99 ?>
100 <option value="<?php echo esc_attr( $value ); ?>"<?php selected( $field['default_value'], $value ); ?>>
101 <?php echo esc_attr( $label ); ?>
102 </option>
103 <?php
104 }
105 }
106 ?>
107 </select>
108 <?php
109 break;
110
111 /**
112 * Toggle
113 */
114 case 'toggle':
115 ?>
116 <select name="<?php echo esc_attr( $field_name ); ?>"
117 id="tinymce_modal_<?php echo esc_attr( $field_name ); ?>"
118 <?php echo $data_attributes; // phpcs:ignore ?>
119 size="1"
120 class="widefat <?php echo esc_attr( isset( $field['class'] ) ? $field['class'] : '' ); ?>">
121 <?php
122 $field['default_value'] = ( isset( $shortcode['attributes'][ $field_name ]['default'] ) ? $shortcode['attributes'][ $field_name ]['default'] : '' );
123 ?>
124 <option value="0"<?php selected( $field['default_value'], 0 ); ?>><?php esc_html_e( 'No', 'convertkit' ); ?></option>
125 <option value="1"<?php selected( $field['default_value'], 1 ); ?>><?php esc_html_e( 'Yes', 'convertkit' ); ?></option>
126 </select>
127 <?php
128 break;
129 }
130
131 if ( isset( $field['description'] ) ) {
132 ?>
133 <p class="description">
134 <?php echo esc_attr( $field['description'] ); ?>
135 </p>
136 <?php
137 }
138