| @@ -1,56 +1,26 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Getwid\Blocks; |
| 4 | 4 | |
| 5 | -class Table extends \Getwid\Blocks\AbstractBlock { | |
| 5 | +class Table extends AbstractBlock { | |
| 6 | 6 | |
| 7 | - protected static $blockName = 'getwid/table'; | |
| 7 | + public function __construct() { | |
| 8 | 8 | |
| 9 | - public function __construct() { | |
| 9 | + parent::__construct( 'getwid/table' ); | |
| 10 | 10 | |
| 11 | - parent::__construct( self::$blockName ); | |
| 12 | - | |
| 13 | - register_block_type( | |
| 14 | - 'getwid/table', | |
| 11 | + register_block_type( | |
| 12 | + getwid_get_plugin_path( 'assets/blocks/table' ), | |
| 15 | 13 | array( |
| 16 | - 'render_callback' => [ $this, 'render_callback' ] | |
| 14 | + 'render_callback' => array( $this, 'render_callback' ), | |
| 17 | 15 | ) |
| 18 | - ); | |
| 19 | - } | |
| 16 | + ); | |
| 17 | + } | |
| 20 | 18 | |
| 21 | - public function getLabel() { | |
| 19 | + public function get_label() { | |
| 22 | 20 | return __( 'Table', 'getwid' ); |
| 23 | 21 | } |
| 24 | - | |
| 25 | - public function block_frontend_assets() { | |
| 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/table/style' . $rtl . '.css' ), | |
| 40 | - [], | |
| 41 | - getwid()->settings()->getVersion() | |
| 42 | - ); | |
| 43 | - } | |
| 44 | - | |
| 45 | - public function render_callback( $attributes, $content ) { | |
| 46 | - | |
| 47 | - $this->block_frontend_assets(); | |
| 48 | - | |
| 49 | - return $content; | |
| 50 | - } | |
| 51 | - | |
| 52 | 22 | } |
| 53 | 23 | |
| 54 | 24 | getwid()->blocksManager()->addBlock( |
| 55 | - new \Getwid\Blocks\Table() | |
| 25 | + new Table() | |
| 56 | 26 | ); |