| 1 |
<?php |
| 2 |
|
| 3 |
namespace Getwid\Blocks; |
| 4 |
|
| 5 |
class ImageHotspot extends AbstractBlock { |
| 6 |
|
| 7 |
public function __construct() { |
| 8 |
|
| 9 |
parent::__construct( 'getwid/image-hotspot' ); |
| 10 |
|
| 11 |
register_block_type( |
| 12 |
getwid_get_plugin_path( 'assets/blocks/image-hotspot' ) |
| 13 |
); |
| 14 |
|
| 15 |
add_action( 'enqueue_block_assets', array( $this, 'add_block_assets' ) ); |
| 16 |
} |
| 17 |
|
| 18 |
public function get_label() { |
| 19 |
return __( 'Image Hotspot', 'getwid' ); |
| 20 |
} |
| 21 |
|
| 22 |
public function add_block_assets() { |
| 23 |
if ( ! is_admin() ) { |
| 24 |
return; |
| 25 |
} |
| 26 |
|
| 27 |
wp_enqueue_script( 'tippy' ); |
| 28 |
} |
| 29 |
} |
| 30 |
|
| 31 |
getwid()->blocksManager()->addBlock( |
| 32 |
new ImageHotspot() |
| 33 |
); |
| 34 |
|