|
|
@ -5,13 +5,13 @@ namespace AXEWEB_Blocks\Blocks\<%= ownerClass %>\<%= blockClassModel %>; |
|
|
class <%= blockClassModel %>_Component extends \Core\Component { |
|
|
class <%= blockClassModel %>_Component extends \Core\Component { |
|
|
|
|
|
|
|
|
public function get_content( $args = [] ): string { |
|
|
public function get_content( $args = [] ): string { |
|
|
$default_args = apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::default_args', [] ); // Not really practical. |
|
|
$default_args = apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::default_args', [] ); // Not really practical. |
|
|
|
|
|
|
|
|
$args = apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::prepare_args', array_merge( $default_args, $args ) ); |
|
|
$args = apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::prepare_args', array_merge( $default_args, $args ) ); |
|
|
|
|
|
|
|
|
$output = ( include( __DIR__ . '/templates/<%= blockFilename %>.template.php' ) )( $args, self::class ); |
|
|
$output = ( include( __DIR__ . '/templates/<%= blockFilename %>.template.php' ) )( $args, self::class ); |
|
|
|
|
|
|
|
|
return apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::content', $output ); |
|
|
return apply_filters( 'axeweb_blocks/<%= ownerFilename %>/<%= blockFilename %>::content', $output ); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
<% if (!include_acf_block && !include_native_gutenberg_block) { %>function register_assets(): void { |
|
|
<% if (!include_acf_block && !include_native_gutenberg_block) { %>function register_assets(): void { |
|
|
@ -24,7 +24,6 @@ class <%= blockClassModel %>_Component extends \Core\Component { |
|
|
|
|
|
|
|
|
wp_enqueue_script( 'script-block-<%= blockFilename %>' ); |
|
|
wp_enqueue_script( 'script-block-<%= blockFilename %>' ); |
|
|
}<% } %> |
|
|
}<% } %> |
|
|
|
|
|
|
|
|
<% if (include_elementor_widget) { %>function register_custom_logic(): void { |
|
|
<% if (include_elementor_widget) { %>function register_custom_logic(): void { |
|
|
add_action( 'elementor/widgets/widgets_registered', [ $this, 'register_elementor_widget' ] ); |
|
|
add_action( 'elementor/widgets/widgets_registered', [ $this, 'register_elementor_widget' ] ); |
|
|
} |
|
|
} |
|
|
@ -34,8 +33,8 @@ class <%= blockClassModel %>_Component extends \Core\Component { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
<% } %><% if (include_acf_block) { %> function register_acf_block() { |
|
|
<% } %><% if (include_acf_block) { %> function register_acf_block() { |
|
|
$this->register_block( __DIR__ . "/<%= blockFilename %>.block.json", [ |
|
|
$this->register_block( __DIR__ . "/<%= blockFilename %>.block.json", [ |
|
|
'style_assets' => [ |
|
|
'style_assets' => [ |
|
|
[ |
|
|
[ |
|
|
'name' => '<%= blockFilename %>', |
|
|
'name' => '<%= blockFilename %>', |
|
|
'url' => plugins_url( 'templates/styles/<%= blockFilename %>.min.css', __FILE__ ), |
|
|
'url' => plugins_url( 'templates/styles/<%= blockFilename %>.min.css', __FILE__ ), |
|
|
@ -47,9 +46,8 @@ class <%= blockClassModel %>_Component extends \Core\Component { |
|
|
'url' => plugins_url( 'templates/scripts/<%= blockFilename %>.min.js', __FILE__ ), |
|
|
'url' => plugins_url( 'templates/scripts/<%= blockFilename %>.min.js', __FILE__ ), |
|
|
] |
|
|
] |
|
|
] |
|
|
] |
|
|
] ); |
|
|
] ); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
<% } %><% if (include_native_gutenberg_block) { %> function register_native_gutenberg_block() { |
|
|
<% } %><% if (include_native_gutenberg_block) { %> function register_native_gutenberg_block() { |
|
|
register_block_type( __DIR__ . '/templates/gutenberg-block/block.json' );<% if (include_script) { %> |
|
|
register_block_type( __DIR__ . '/templates/gutenberg-block/block.json' );<% if (include_script) { %> |
|
|
|
|
|
|
|
|
|