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