| @@ -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,9 +97,9 @@ | ||
| 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. |
| @@ -118,9 +118,9 @@ | ||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // Enqueue block scripts and styles in the editor view. |
| 121 | 121 | add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
| 122 | - add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_styles' ) ); | |
| 122 | + add_action( 'enqueue_block_assets', array( $this, 'enqueue_styles' ) ); | |
| 123 | 123 | |
| 124 | 124 | // Enqueue block scripts and styles in the editor and frontend views. |
| 125 | 125 | add_action( 'enqueue_block_assets', array( $this, 'enqueue_scripts_editor_and_frontend' ) ); |
| 126 | 126 | add_action( 'enqueue_block_assets', array( $this, 'enqueue_styles_editor_and_frontend' ) ); |
| @@ -142,14 +142,18 @@ | ||
| 142 | 142 | // Get settings. |
| 143 | 143 | $settings = new ConvertKit_Settings(); |
| 144 | 144 | |
| 145 | 145 | // Get blocks and block toolbar buttons. |
| 146 | - $blocks = convertkit_get_blocks(); | |
| 147 | - $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(); | |
| 148 | 149 | |
| 149 | 150 | // Enqueue Gutenberg Javascript, and set the blocks data. |
| 150 | 151 | wp_enqueue_script( 'convertkit-gutenberg', CONVERTKIT_PLUGIN_URL . 'resources/backend/js/gutenberg.js', array( 'jquery' ), CONVERTKIT_PLUGIN_VERSION, true ); |
| 151 | 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 | + } | |
| 152 | 156 | wp_localize_script( |
| 153 | 157 | 'convertkit-gutenberg', |
| 154 | 158 | 'convertkit_gutenberg', |
| 155 | 159 | array( |
| @@ -182,10 +186,10 @@ | ||
| 182 | 186 | * @since 1.9.6.9 |
| 183 | 187 | */ |
| 184 | 188 | public function enqueue_styles() { |
| 185 | 189 | |
| 186 | - // Bail if request isn't for the Admin or a Frontend Editor. | |
| 187 | - if ( ! WP_ConvertKit()->is_admin_or_frontend_editor() ) { | |
| 190 | + // Bail if request isn't for the Admin. | |
| 191 | + if ( ! is_admin() ) { | |
| 188 | 192 | return; |
| 189 | 193 | } |
| 190 | 194 | |
| 191 | 195 | /** |