From 80464a61d7795ccac63f5affd5b183311b554ec2 Mon Sep 17 00:00:00 2001 From: Roman Axelrod Date: Fri, 17 Feb 2023 13:50:40 +0200 Subject: [PATCH] Update output code format. --- platforms/php/build.php | 4 ++-- platforms/wordpress/templates/Template_Basic_Component.php | 5 ++--- platforms/wordpress/templates/Template_Component.php | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/platforms/php/build.php b/platforms/php/build.php index 0aa0e15..d1b82b2 100644 --- a/platforms/php/build.php +++ b/platforms/php/build.php @@ -63,7 +63,7 @@ class Component_Builder { $this->project_path = $args['projectPath']; $this->component_name = $args['blockName']; - $this->dist_path = __DIR__ . '/' . $this->module_path . '../../' . $this->project_path . '/exports' . '/' . $args['platform']; + $this->dist_path = __DIR__ . '/' . $this->module_path . '/../../' . $this->project_path . '/exports' . '/' . $args['platform']; $this->register_default_handlebar_helpers(); } @@ -73,7 +73,7 @@ class Component_Builder { $this->buildTemplatePhpFile( $root_path ); } - private function buildTemplatePhpFile( $root_path, $platform = 'wordpress' ): void { + private function buildTemplatePhpFile( $root_path ): void { $file_name = $this->get_handlebars_template( "$root_path/src/$this->component_name.template.hbs" ); $output_folder = $this->dist_path . '/templates'; diff --git a/platforms/wordpress/templates/Template_Basic_Component.php b/platforms/wordpress/templates/Template_Basic_Component.php index ad3ca54..c766331 100644 --- a/platforms/wordpress/templates/Template_Basic_Component.php +++ b/platforms/wordpress/templates/Template_Basic_Component.php @@ -19,9 +19,9 @@ class <%= blockClassModel %>_Component <% if (isComponentManager || isElementor) wp_register_style( 'block-<%= blockFilename %>', $base_path . 'templates/styles/<%= blockFilename %>.min.css', $style_deps, self::VERSION ); $script_deps = apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::script_deps', [ 'assets-script' ] ); - wp_register_script( 'block-<%= blockFilename %>', $base_path . 'templates/scripts/<%= blockFilename %>.min.js', $script_deps, self::VERSION, true ); + wp_register_script( 'block-<%= blockFilename %>', $base_path . 'templates/scripts/<%= blockFilename %>.min.js', $script_deps, self::VERSION, true );<% if (!isElementor) { %> - <% if (!isElementor) { %>if ( ! is_admin() ) { + if ( ! is_admin() ) { wp_enqueue_style( 'block-<%= blockFilename %>' ); wp_enqueue_script( 'block-<%= blockFilename %>' ); }<% } %> @@ -46,7 +46,6 @@ class <%= blockClassModel %>_Component <% if (isComponentManager || isElementor) $widgets_manager->register_widget_type( new Helpers\<%= blockClassModel %>_Elementor_Widget() ); } <% } %> - } <% if (isComponentManager) { %><%= blockClassModel %>_Component::get_instance();<% } else { diff --git a/platforms/wordpress/templates/Template_Component.php b/platforms/wordpress/templates/Template_Component.php index 3e98e8d..441f6d9 100644 --- a/platforms/wordpress/templates/Template_Component.php +++ b/platforms/wordpress/templates/Template_Component.php @@ -32,7 +32,7 @@ class <%= blockClassModel %>_Component extends \Core\Component { $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' => [ [