PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 2.8.6
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v2.8.6
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
← All changes | includes/class-convertkit-gutenberg.php +14 -9 2.2.6 → 2.8.6 View file →
@@ -50,9 +50,9 @@
50 50 $categories,
51 51 array(
52 52 array(
53 53 'slug' => 'convertkit',
54 - 'title' => 'ConvertKit',
54 + 'title' => 'Kit',
55 55 ),
56 56 )
57 57 );
58 58
@@ -86,9 +86,9 @@
86 86 // Get blocks.
87 87 $blocks = convertkit_get_blocks();
88 88
89 89 // Bail if no blocks are available.
90 - if ( ! is_array( $blocks ) || ! count( $blocks ) ) {
90 + if ( ! count( $blocks ) ) {
91 91 return;
92 92 }
93 93
94 94 // Get registered blocks.
@@ -97,15 +97,15 @@
97 97 // Iterate through blocks, registering them.
98 98 foreach ( $blocks as $block => $properties ) {
99 99
100 100 // Skip if this block has already been registered.
101 - if ( is_array( $registered_blocks ) && in_array( 'convertkit/' . $block, $registered_blocks, true ) ) {
101 + if ( in_array( 'convertkit/' . $block, $registered_blocks, true ) ) {
102 102 continue;
103 103 }
104 104
105 105 // Register block.
106 106 register_block_type(
107 - 'convertkit/' . $block,
107 + CONVERTKIT_PLUGIN_PATH . '/includes/blocks/' . $block,
108 108 array(
109 109 'attributes' => $properties['attributes'],
110 110 'editor_script' => 'convertkit-gutenberg',
111 111 'render_callback' => array(
@@ -113,13 +113,14 @@
113 113 $properties['render_callback'][1],
114 114 ),
115 115 )
116 116 );
117 +
117 118 }
118 119
119 120 // Enqueue block scripts and styles in the editor view.
120 121 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
121 - add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_styles' ) );
122 + add_action( 'enqueue_block_assets', array( $this, 'enqueue_styles' ) );
122 123
123 124 // Enqueue block scripts and styles in the editor and frontend views.
124 125 add_action( 'enqueue_block_assets', array( $this, 'enqueue_scripts_editor_and_frontend' ) );
125 126 add_action( 'enqueue_block_assets', array( $this, 'enqueue_styles_editor_and_frontend' ) );
@@ -141,14 +142,18 @@
141 142 // Get settings.
142 143 $settings = new ConvertKit_Settings();
143 144
144 145 // Get blocks and block toolbar buttons.
145 - $blocks = convertkit_get_blocks();
146 - $block_formatters = convertkit_get_block_formatters();
146 + $blocks = convertkit_get_blocks();
147 + $block_formatters = convertkit_get_block_formatters();
148 + $pre_publish_actions = convertkit_get_pre_publish_actions();
147 149
148 150 // Enqueue Gutenberg Javascript, and set the blocks data.
149 151 wp_enqueue_script( 'convertkit-gutenberg', CONVERTKIT_PLUGIN_URL . 'resources/backend/js/gutenberg.js', array( 'jquery' ), CONVERTKIT_PLUGIN_VERSION, true );
150 152 wp_localize_script( 'convertkit-gutenberg', 'convertkit_blocks', $blocks );
153 + if ( count( $pre_publish_actions ) ) {
154 + wp_localize_script( 'convertkit-gutenberg', 'convertkit_pre_publish_actions', $pre_publish_actions );
155 + }
151 156 wp_localize_script(
152 157 'convertkit-gutenberg',
153 158 'convertkit_gutenberg',
154 159 array(
@@ -181,10 +186,10 @@
181 186 * @since 1.9.6.9
182 187 */
183 188 public function enqueue_styles() {
184 189
185 - // Bail if request isn't for the Admin or a Frontend Editor.
186 - if ( ! WP_ConvertKit()->is_admin_or_frontend_editor() ) {
190 + // Bail if request isn't for the Admin.
191 + if ( ! is_admin() ) {
187 192 return;
188 193 }
189 194
190 195 /**