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/banner.php +10 -43 2.1.13.0.2 View file →
@@ -1,56 +1,23 @@
1 1 <?php
2 2
3 3 namespace Getwid\Blocks;
4 4
5 -class Banner extends \Getwid\Blocks\AbstractBlock {
5 +class Banner extends AbstractBlock {
6 6
7 - protected static $blockName = 'getwid/banner';
7 + public function __construct() {
8 8
9 - public function __construct() {
9 + parent::__construct( 'getwid/banner' );
10 10
11 - parent::__construct( self::$blockName );
11 + register_block_type(
12 + getwid_get_plugin_path( 'assets/blocks/banner' )
13 + );
14 + }
12 15
13 - register_block_type(
14 - 'getwid/banner',
15 - array(
16 - 'render_callback' => [ $this, 'render_callback' ]
17 - )
18 - );
19 - }
20 -
21 - public function getLabel() {
22 - return __('Banner', 'getwid');
16 + public function get_label() {
17 + return __( 'Banner', 'getwid' );
23 18 }
24 -
25 - public function block_frontend_assets( $attributes = null ) {
26 -
27 - if ( is_admin() ) {
28 - return;
29 - }
30 -
31 - if ( FALSE == getwid()->assetsOptimization()->load_assets_on_demand() ) {
32 - return;
33 - }
34 -
35 - $rtl = is_rtl() ? '.rtl' : '';
36 -
37 - wp_enqueue_style(
38 - self::$blockName,
39 - getwid_get_plugin_url( 'assets/blocks/banner/style' . $rtl . '.css' ),
40 - [],
41 - getwid()->settings()->getVersion()
42 - );
43 - }
44 -
45 - public function render_callback( $attributes, $content ) {
46 -
47 - $this->block_frontend_assets( $attributes );
48 -
49 - return $content;
50 - }
51 -
52 19 }
53 20
54 21 getwid()->blocksManager()->addBlock(
55 - new \Getwid\Blocks\Banner()
22 + new Banner()
56 23 );