Update templates, white spacings and code format.
This commit is contained in:
@@ -59,8 +59,8 @@ class Component_Builder {
|
||||
private string $dist_path = '';
|
||||
|
||||
function __construct( $args = [] ) {
|
||||
if ( empty( $args['backPath'] ) || empty( $args['projectPath'] ) || empty( $args['blockName'] ) || empty( $args['platform'] ) ) {
|
||||
die( 'Error: Missing arguments. Make sure all parameter passed.' );
|
||||
if ( ! isset( $args['backPath'] ) || ! isset( $args['projectPath'] ) || ! isset( $args['blockName'] ) || ! isset( $args['platform'] ) ) {
|
||||
throw new \Exception( 'Error: Missing arguments. Make sure all parameter passed.' );
|
||||
}
|
||||
|
||||
$this->module_path = $args['backPath'];
|
||||
@@ -121,7 +121,7 @@ class Component_Builder {
|
||||
|
||||
$t = file_put_contents( $file_path, '<?php ' . $comment . $content . ' ?>' );
|
||||
if ( $t === false ) {
|
||||
die( "Error: Can't generate HBS template to PHP file. Cache folder is not accessible." );
|
||||
throw new \Exception( "Error: Can't generate HBS template to PHP file. Cache folder is not accessible." );
|
||||
}
|
||||
|
||||
return $file_path;
|
||||
|
||||
@@ -44,8 +44,8 @@ class <%= blockClassModel %>_Component <% if (isComponentManager || isElementor)
|
||||
function register_elementor_widget( $widgets_manager ): void {
|
||||
require_once "helpers/<%= blockClassModel %>_Elementor_Widget.php";
|
||||
$widgets_manager->register_widget_type( new Helpers\<%= blockClassModel %>_Elementor_Widget() );
|
||||
}
|
||||
<% } %>
|
||||
}<% } %>
|
||||
|
||||
}
|
||||
|
||||
<% if (isComponentManager) { %><%= blockClassModel %>_Component::get_instance();<% } else {
|
||||
|
||||
@@ -24,15 +24,7 @@ class <%= blockClassModel %>_Component extends \Core\Component {
|
||||
|
||||
wp_enqueue_script( 'script-block-<%= blockFilename %>' );
|
||||
}<% } %>
|
||||
<% if (include_elementor_widget) { %>function register_custom_logic(): void {
|
||||
add_action( 'elementor/widgets/widgets_registered', [ $this, 'register_elementor_widget' ] );
|
||||
}
|
||||
|
||||
<% } %><% if (include_elementor_widget) { %> function register_elementor_widget( $widgets_manager ) {
|
||||
$widgets_manager->register_widget_type( new Helpers\<%= blockClassModel %>_Elementor_Widget() );
|
||||
}
|
||||
|
||||
<% } %><% if (include_acf_block) { %> function register_acf_block() {
|
||||
<% if (include_acf_block) { %> function register_acf_block() {
|
||||
$this->register_block( __DIR__ . "/<%= blockFilename %>.block.json", [
|
||||
'style_assets' => [
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user