1: <?php
2: /**
3: * Functions to register client-side assets (scripts and stylesheets) for the Gutenberg block.
4: *
5: * @package event-post
6: * @version 6.0.1
7: * @since 5.2
8: * @see https://wordpress.org/gutenberg/handbook/blocks/writing-your-first-block-type/#enqueuing-block-scripts
9: */
10:
11: if ( ! defined( 'ABSPATH' ) ) exit;
12:
13: /**
14: * Registers eventpost/timeline block
15: */
16:
17: function eventpost_timeline_block_init() {
18: $dir_path = EventPost()->plugin_path;
19: $dir = dirname( __DIR__ );
20:
21: wp_register_script('event-post-timeline', plugins_url('/build/timeline/event-timeline.js', $dir), ['jquery'], false, true);
22:
23: \register_block_type( $dir_path . '/build/timeline', array(
24: 'render_callback' => array(EventPost()->Shortcodes, 'shortcode_timeline'),
25: 'script' => 'event-post-timeline',
26: ));
27: }
28: add_action( 'wp_loaded', 'eventpost_timeline_block_init' );
29: