1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37:
<?php
function eventsmap_block_init() {
$dir = dirname( __DIR__ );
$dir_path = EventPost()->plugin_path;
$block_js = 'build/map/index.js';
wp_register_script('event-post-map-block-editor',plugins_url( $block_js, $dir ),array( 'wp-blocks', 'wp-i18n', 'wp-element',),filemtime( "$dir_path/$block_js" ));
wp_set_script_translations( 'event-post-map-block-editor', 'event-post' );
wp_localize_script('event-post-map-block-editor', 'eventpost_gut_params', array('maptiles' => EventPost()->maps,'map_interactions'=>EventPost()->map_interactions,));
wp_register_style('event-post-map-block-editor-style', plugins_url('/build/map/index.css', $dir), []);
\register_block_type( $dir_path . '/build/map', array(
'editor_script' => 'event-post-map-block-editor',
'script' => 'event-post-map-block-editor-script-front-end',
'style' => 'event-post-map-block-editor-style',
'render_callback' => array(EventPost()->Shortcodes, 'shortcode_map'),
));
}
add_action( 'init', 'eventsmap_block_init' );