Updated Build Template of Elementor block.
This commit is contained in:
@@ -7,7 +7,8 @@ class <%= blockClassModel %>_Component <% if (isComponentManager || isElementor)
|
|||||||
public $hook_prefix = 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>';<% } %>
|
public $hook_prefix = 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>';<% } %>
|
||||||
|
|
||||||
<% if (!isComponentManager) { %>public function __construct() {
|
<% 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' ] );
|
add_action( 'after_setup_theme', [ $this, 'register_assets' ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,30 +18,16 @@ class <%= blockClassModel %>_Elementor_Widget extends \Elementor\Widget_Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function _register_controls() {
|
protected function _register_controls() {
|
||||||
$this->start_controls_section( 'section_content', [ 'label' => 'Content' ] );
|
$block_data = \Core\Block::get_block_data( __DIR__ . '/../<%= blockFilename %>.block.json' );
|
||||||
|
\Core\Elementor_Block::register_groups( $block_data, $this );
|
||||||
$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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_style_depends() {
|
function get_style_depends() {
|
||||||
return [ '<%= blockFilename %>' ];
|
return [ 'block-<%= blockFilename %>' ];
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_script_depends() {
|
function get_script_depends() {
|
||||||
return [ 'script-<%= blockFilename %>' ];
|
return [ 'block-<%= blockFilename %>' ];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function render() {
|
protected function render() {
|
||||||
|
|||||||
Reference in New Issue
Block a user