You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

31 lines
964 B

<?php
use Core\Global_Functions;
class <%= blockClassModel %>_Component {
public function __construct() {
add_action( 'wp_enqueue_scripts', [ $this, 'register_assets' ] );
}
function register_assets(): void {
wp_enqueue_style( '<%= blockFilename %>',
get_template_directory_uri() . '/components/partials/<%= blockFilename %>/templates/styles/<%= blockFilename %>.min.css',
[ 'style-wp' ],
Global_Functions::get_current_version_number()
);
wp_enqueue_script( '<%= blockFilename %>',
get_template_directory_uri() . '/components/partials/<%= blockFilename %>/templates/scripts/<%= blockFilename %>.min.js',
[ 'jquery', 'swiper' ],
Global_Functions::get_current_version_number(),
true
);
}
public function render( $args = [] ): void {
$output = ( include( __DIR__ . '/templates/<%= blockFilename %>.template.php' ) )( array_merge( [], $args ), self::class );
echo apply_filters( 'the_content', wpautop( $output ) );
}
}