PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.3.65
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.3.65
11.3.75 11.3.73 11.3.71 11.3.70 11.3.69 11.3.64 11.3.65 11.3.62 11.3.61 11.3.56 11.3.58 11.0.31 11.0.52 11.0.54 11.0.56 11.0.58 11.0.7 11.1.10 11.1.11 11.1.13 11.1.14 11.1.15 11.1.2 11.1.20 11.1.21 All 73 releases
leadin / public / admin / class-gutenberg.php

class-gutenberg.php in HubSpot All-In-One Marketing – Forms, Popups, Live Chat 11.3.65, at public/admin/class-gutenberg.php

60 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Leadin\admin;
4
5 use Leadin\AssetsManager;
6 use Leadin\utils\Versions;
7
8 /**
9 * Contains all the methods used to initialize Gutenberg blocks.
10 */
11 class Gutenberg {
12 /**
13 * Class constructor, register Gutenberg blocks.
14 */
15 public function __construct() {
16 if ( ! function_exists( 'register_block_type' ) ) {
17 // Gutenberg is not active.
18 return;
19 }
20
21 add_action( 'init', array( $this, 'register_gutenberg_block' ) );
22 add_filter( 'block_categories_all', array( $this, 'add_hubspot_category' ) );
23 }
24
25 /**
26 * Add HubSpot category to Gutenberg blocks.
27 *
28 * @param Array $categories Array of block categories.
29 */
30 public function add_hubspot_category( $categories ) {
31 return array_merge(
32 $categories,
33 array(
34 array(
35 'slug' => 'leadin-blocks',
36 'title' => __( 'HubSpot', 'leadin' ),
37 ),
38 )
39 );
40 }
41 /**
42 * Register HubSpot Form Gutenberg block.
43 */
44 public function register_gutenberg_block() {
45 AssetsManager::localize_gutenberg();
46 register_block_type(
47 'leadin/hubspot-form-block',
48 array(
49 'editor_script' => AssetsManager::GUTENBERG,
50 )
51 );
52 register_block_type(
53 'leadin/hubspot-meeting-block',
54 array(
55 'editor_script' => AssetsManager::GUTENBERG,
56 )
57 );
58 }
59 }
60