PluginProbe
Event Post / 6.1.2
Event Post v6.1.2
6.1.2 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 All 47 releases
← All changes | inc/blocks/eventslist.php +14 -40 5.6 → 6.1.2 View file →
@@ -1,50 +1,24 @@
1 1 <?php
2 2 /**
3 - * Functions to register client-side assets (scripts and stylesheets) for the
4 - * Gutenberg block.
3 + * Functions to register client-side assets (scripts and stylesheets) for the Gutenberg block.
5 4 *
6 5 * @package event-post
6 + * @version 6.1.2
7 + * @since 5.2
8 + * @see https://wordpress.org/gutenberg/handbook/blocks/writing-your-first-block-type/#enqueuing-block-scripts
7 9 */
8 10
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 - * @since 5.2
11 +if ( ! defined( 'ABSPATH' ) ) exit;
12 +
13 + /**
14 + * Registers eventpost/list block
15 15 */
16 +
16 17 function eventpost_list_block_init() {
17 - global $EventPost;
18 - $dir_path = $EventPost->plugin_path;
19 - $dir = dirname( __DIR__ );
18 + $dir_path = EventPost()->plugin_path;
20 19
21 - $block_js = 'js/block-list.min.js';
22 - wp_register_script(
23 - 'event-post-list-block-editor',
24 - plugins_url( $block_js, $dir ),
25 - array(
26 - 'wp-blocks',
27 - 'wp-editor',
28 - 'wp-components',
29 - 'wp-i18n',
30 - 'wp-element',
31 - ),
32 - filemtime( "$dir_path/$block_js" )
33 - );
34 - wp_set_script_translations( 'event-post-list-block-editor', 'event-post' );
35 -
36 - $block_css = 'css/block-list.css';
37 - wp_register_style(
38 - 'event-post-list-block-editor',
39 - plugins_url( $block_css, $dir ),
40 - array(),
41 - filemtime( "$dir_path/$block_css" )
42 - );
43 -
44 - register_block_type( 'eventpost/list', array(
45 - 'editor_script' => 'event-post-list-block-editor',
46 - 'editor_style' => 'event-post-list-block-editor',
47 - 'render_callback' => array($EventPost->Shortcodes, 'shortcode_list'),
48 - ) );
20 + \register_block_type( $dir_path . '/build/list', array(
21 + 'render_callback' => array(EventPost()->Shortcodes, 'shortcode_list'),
22 + ));
49 23 }
50 -add_action( 'init', 'eventpost_list_block_init' );
24 +add_action( 'wp_loaded', 'eventpost_list_block_init' );