PluginProbe
OffCanvas / Drawer – add sleek slide-in panels to any page / 2.0.0
OffCanvas / Drawer – add sleek slide-in panels to any page v2.0.0
2.0.7 2.0.6 2.0.5 trunk 1.0.0 1.0.1 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4
offcanvas-block / offcanvas-block.php

offcanvas-block.php in OffCanvas / Drawer – add sleek slide-in panels to any page 2.0.0, at offcanvas-block.php

38 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( !class_exists( 'OCBOffCanvas' ) ) {
4 class OCBOffCanvas
5 {
6 public function __construct() {
7 add_action( 'init', [ $this, 'onInit' ] );
8 add_action( 'enqueue_block_editor_assets', [ $this, 'obEnqueueEditorAssets' ] );
9 add_action( 'wp_enqueue_scripts', [ $this, 'obEnqueueViewAssets' ] );
10 }
11
12 public function onInit()
13 {
14 register_block_type( __DIR__ . '/build' );
15
16 }
17
18 public function obEnqueueEditorAssets() {
19 wp_add_inline_script(
20 'ocb-offcanvas-editor-script',
21 'const obIsPipeChecker = ' . wp_json_encode( obIsPremium() ) . ';',
22 'before'
23 );
24
25 }
26
27 public function obEnqueueViewAssets() {
28 wp_add_inline_script(
29 'ocb-offcanvas-view-script',
30 'const obIsPipeChecker = ' . wp_json_encode( obIsPremium() ) . ';',
31 'before'
32 );
33
34 }
35 }
36
37 new OCBOffCanvas();
38 }