Browse Source

Updated Build Template of Elementor block.

pull/8/head
Roman Axelrod 3 years ago
parent
commit
df7866b8b5
  1. 3
      platforms/wordpress/templates/Template_Basic_Component.php
  2. 22
      platforms/wordpress/templates/helpers/Template_Elementor_Widget.php

3
platforms/wordpress/templates/Template_Basic_Component.php

@ -7,7 +7,8 @@ class <%= blockClassModel %>_Component <% if (isComponentManager || isElementor)
public $hook_prefix = 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>';<% } %>
<% if (!isComponentManager) { %>public function __construct() {
// add_action( 'wp_enqueue_scripts', [ $this, 'register_assets' ] );
<% if (isElementor) { %>parent::__construct();
<% } %>// add_action( 'wp_enqueue_scripts', [ $this, 'register_assets' ] );
add_action( 'after_setup_theme', [ $this, 'register_assets' ] );
}

22
platforms/wordpress/templates/helpers/Template_Elementor_Widget.php

@ -18,30 +18,16 @@ class <%= blockClassModel %>_Elementor_Widget extends \Elementor\Widget_Base {
}
protected function _register_controls() {
$this->start_controls_section( 'section_content', [ 'label' => 'Content' ] );
$repeater = new \Elementor\Repeater();
// $repeater->add_control(
// 'video_url', [
// 'label' => 'YouTube URL',
// 'type' => \Elementor\Controls_Manager::URL,
// 'label_block' => true,
// 'condition' => [
// 'type' => 'video',
// ],
// ]
// );
$this->end_controls_section();
$block_data = \Core\Block::get_block_data( __DIR__ . '/../<%= blockFilename %>.block.json' );
\Core\Elementor_Block::register_groups( $block_data, $this );
}
function get_style_depends() {
return [ '<%= blockFilename %>' ];
return [ 'block-<%= blockFilename %>' ];
}
function get_script_depends() {
return [ 'script-<%= blockFilename %>' ];
return [ 'block-<%= blockFilename %>' ];
}
protected function render() {

Loading…
Cancel
Save