PluginProbe
Event Post / 5.1
Event Post v5.1
6.1.1 6.1.0 6.0.1 6.0.0 5.12.0 trunk 3.9 4.0 4.2 4.3 4.4 4.5 5.0 5.1 5.10.0 5.10.1 5.10.2 5.10.3 5.10.4 5.11.0 5.11.1 5.2 5.5 5.6 5.6.1 All 46 releases
event-post / blocks / eventsmap.php

eventsmap.php in Event Post 5.1, at blocks/eventsmap.php

52 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 * Functions to register client-side assets (scripts and stylesheets) for the
4 * Gutenberg block.
5 *
6 * @package event-post
7 */
8
9 /**
10 * Registers all block assets so that they can be enqueued through Gutenberg in
11 * the corresponding context.
12 *
13 * @see https://wordpress.org/gutenberg/handbook/blocks/writing-your-first-block-type/#enqueuing-block-scripts
14 */
15 function eventsmap_block_init() {
16 global $EventPost;
17 $dir = dirname( __FILE__ );
18
19 $block_js = 'eventsmap/block.js';
20 wp_register_script(
21 'eventsmap-block-editor',
22 plugins_url( $block_js, __FILE__ ),
23 array(
24 'wp-blocks',
25 'wp-i18n',
26 'wp-element',
27 ),
28 filemtime( "$dir/$block_js" )
29 );
30
31 $editor_css = 'eventsmap/editor.css';
32 wp_register_style(
33 'eventsmap-block-editor',
34 plugins_url( $editor_css, __FILE__ ),
35 array(
36 'wp-blocks',
37 ),
38 filemtime( "$dir/$editor_css" )
39 );
40
41 register_block_type( 'event-post/eventsmap', array(
42 'editor_script' => 'eventsmap-block-editor',
43 'editor_style' => 'eventsmap-block-editor',
44 ) );
45
46 wp_localize_script('eventsmap-block-editor', 'eventpost_gut_params', array(
47 'maptiles' => $EventPost->maps,
48 'map_interactions'=>$EventPost->map_interactions,
49 ));
50 }
51 add_action( 'init', 'eventsmap_block_init' );
52