PluginProbe
Getwid – Gutenberg Blocks / 3.0.2
Getwid – Gutenberg Blocks v3.0.2
3.0.2 3.0.1 3.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.2.0 trunk 1.8.7 1.9.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9
← All changes | includes/blocks/advanced-spacer.php +6 -41 2.0.143.0.2 View file →
@@ -1,58 +1,23 @@
1 1 <?php
2 2
3 3 namespace Getwid\Blocks;
4 4
5 -class AdvancedSpacer extends \Getwid\Blocks\AbstractBlock {
5 +class AdvancedSpacer extends AbstractBlock {
6 6
7 - protected static $blockName = 'getwid/advanced-spacer';
8 -
9 7 public function __construct() {
10 8
11 - parent::__construct( self::$blockName );
9 + parent::__construct( 'getwid/advanced-spacer' );
12 10
13 11 register_block_type(
14 - 'getwid/advanced-spacer',
15 - array(
16 - 'render_callback' => [ $this, 'render_callback' ]
17 - )
12 + getwid_get_plugin_path( 'assets/blocks/advanced-spacer' )
18 13 );
19 -
20 14 }
21 15
22 - public function getLabel() {
23 - return __('Advanced Spacer', 'getwid');
16 + public function get_label() {
17 + return __( 'Advanced Spacer', 'getwid' );
24 18 }
25 -
26 - public function block_frontend_assets( $attributes = null ) {
27 -
28 - if ( is_admin() ) {
29 - return;
30 - }
31 -
32 - if ( FALSE == getwid()->assetsOptimization()->load_assets_on_demand() ) {
33 - return;
34 - }
35 -
36 - add_filter( 'getwid/optimize/assets',
37 - function ( $assets ) {
38 - $assets[] = getwid()->settings()->getPrefix() . '-blocks-common';
39 -
40 - return $assets;
41 - }
42 - );
43 -
44 - add_filter( 'getwid/optimize/should_load_common_css', '__return_true' );
45 - }
46 -
47 - public function render_callback( $attributes, $content ) {
48 -
49 - $this->block_frontend_assets( $attributes );
50 -
51 - return $content;
52 - }
53 -
54 19 }
55 20
56 21 getwid()->blocksManager()->addBlock(
57 - new \Getwid\Blocks\AdvancedSpacer()
22 + new AdvancedSpacer()
58 23 );