Merge pull request 'elementor-build' (#8) from elementor-build into master
Reviewed-on: AXE-WEB/block-dev-tool#8
This commit is contained in:
@@ -2,12 +2,13 @@
|
|||||||
|
|
||||||
namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>;
|
namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>;
|
||||||
|
|
||||||
class <%= blockClassModel %>_Component <% if (isComponentManager) { %>extends \Core\Component <% } %>{
|
class <%= blockClassModel %>_Component <% if (isComponentManager || isElementor) { %>extends \Core\Component <% } %>{
|
||||||
const VERSION = '<%= version %>';<% if (isComponentManager) { %>
|
const VERSION = '<%= version %>';<% if (isComponentManager) { %>
|
||||||
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' ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,6 +35,10 @@ class <%= blockClassModel %>_Component <% if (isComponentManager) { %>extends \C
|
|||||||
return apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::content', $output );
|
return apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::content', $output );
|
||||||
}<% if (isElementor) { %>
|
}<% if (isElementor) { %>
|
||||||
|
|
||||||
|
function register_custom_logic(): void {
|
||||||
|
add_action( 'elementor/widgets/widgets_registered', [ $this, 'register_elementor_widget' ] );
|
||||||
|
}
|
||||||
|
|
||||||
function register_elementor_widget( $widgets_manager ): void {
|
function register_elementor_widget( $widgets_manager ): void {
|
||||||
require_once "helpers/<%= blockClassModel %>_Elementor_Widget.php";
|
require_once "helpers/<%= blockClassModel %>_Elementor_Widget.php";
|
||||||
$widgets_manager->register_widget_type( new Helpers\<%= blockClassModel %>_Elementor_Widget() );
|
$widgets_manager->register_widget_type( new Helpers\<%= blockClassModel %>_Elementor_Widget() );
|
||||||
|
|||||||
@@ -18,36 +18,22 @@ 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() {
|
||||||
$settings = $this->get_settings_for_display();
|
$settings = $this->get_settings_for_display();
|
||||||
|
|
||||||
$component = new \AXEWEB_Blocks\Blocks\Scytale\<%= blockClassModel %>\<%= blockClassModel %>_Component();
|
$component = new \AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>\<%= blockClassModel %>_Component();
|
||||||
|
|
||||||
$args = self::prepare( $settings );
|
$args = self::prepare( $settings );
|
||||||
$component->render( $args );
|
$component->render( $args );
|
||||||
|
|||||||
Reference in New Issue
Block a user