diff --git a/platforms/php/build.php b/platforms/php/build.php index abb25b0..cd4fd62 100644 --- a/platforms/php/build.php +++ b/platforms/php/build.php @@ -69,6 +69,11 @@ class Component_Builder { $this->dist_path = __DIR__ . '/' . $this->module_path . '/../../' . $this->project_path . '/exports' . '/' . $args['platform']; $this->register_default_handlebar_helpers(); + + $this->add_handlebar( 'base_url', function ( $context ) { + $path = join( '/', [ 'blocks', $this->block_project, $this->block_name, 'templates' ] ); + return plugins_url( $path . '/', 'axeweb-blocks-library/axeweb-blocks-library.php' ); + } ); } function build(): void { diff --git a/platforms/wordpress/templates/Template_Basic_Component.php b/platforms/wordpress/templates/Template_Basic_Component.php index 2aac763..d8219d4 100644 --- a/platforms/wordpress/templates/Template_Basic_Component.php +++ b/platforms/wordpress/templates/Template_Basic_Component.php @@ -4,6 +4,8 @@ namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>; class <%= blockClassModel %>_Component <% if (isComponentManager || isElementor) { %>extends \Core\Component <% } %>{ const VERSION = '<%= version %>'; + public $block_project = '<%= ownerFilename %>'; + public $block_name = '<%= blockFilename %>'; public $hook_prefix = 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>'; <% if (!isComponentManager && !isElementor) { %>public function __construct() { diff --git a/platforms/wordpress/templates/Template_Component.php b/platforms/wordpress/templates/Template_Component.php index 4433384..c7b0aa5 100644 --- a/platforms/wordpress/templates/Template_Component.php +++ b/platforms/wordpress/templates/Template_Component.php @@ -4,6 +4,8 @@ namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>; class <%= blockClassModel %>_Component extends \Core\Component { const VERSION = '<%= version %>'; + public $block_project = '<%= ownerFilename %>'; + public $block_name = '<%= blockFilename %>'; public $hook_prefix = 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>'; public function get_content( $args = [] ): string {