Skip to content

Commit

Permalink
Merge branch 'master' into feature/TMZ-61-footer
Browse files Browse the repository at this point in the history
  • Loading branch information
mserino committed Oct 21, 2024
2 parents 5acfe28 + 1b9969c commit 25f2d8f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
12 changes: 12 additions & 0 deletions modules/template-parts/assets/js/hello-plus-header-editor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default class helloPlusLogo {
constructor() {
elementor.channels.editor.on( 'helloPlusLogo:change', this.openSiteIdentity );
}

async openSiteIdentity() {
await $e.run( 'panel/global/open' );
$e.route( 'panel/global/settings-site-identity' );
}
}

new helloPlusLogo();
11 changes: 9 additions & 2 deletions modules/template-parts/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,14 @@ public function enqueue(): void {
);
}

public function get_script_depends(): array {
return [ 'hello-plus-header' ];
public function editor_enqueue(): void {
wp_enqueue_script(
'hello-plus-header-editor',
HELLO_PLUS_SCRIPTS_URL . 'hello-plus-header-editor.js',
[ 'elementor-editor' ],
HELLO_PLUS_ELEMENTOR_VERSION,
true
);
}

/**
Expand All @@ -81,5 +87,6 @@ public static function is_active(): bool {
protected function register_hooks(): void {
parent::register_hooks();
add_action( 'wp_enqueue_scripts', [ $this, 'enqueue' ] );
add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'editor_enqueue' ] );
}
}
4 changes: 4 additions & 0 deletions modules/template-parts/widgets/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public function get_style_depends(): array {
return [ 'hello-plus-header' ];
}

public function get_script_depends(): array {
return [ 'hello-plus-header' ];
}

protected function render(): void {
$render_strategy = new Widget_Header_Render( $this );

Expand Down
1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const entryPoints = {
'css/hello-plus-header': path.resolve( modulesDir, 'template-parts/assets/scss', 'hello-plus-header.scss' ),
'css/hello-plus-footer': path.resolve( modulesDir, 'template-parts/assets/scss', 'hello-plus-footer.scss' ),
'js/hello-plus-header': path.resolve( modulesDir, 'template-parts/assets/js', 'hello-plus-header.js' ),
'js/hello-plus-header-editor': path.resolve( modulesDir, 'template-parts/assets/js', 'hello-plus-header-editor.js' ),

// Theme module
'css/theme': path.resolve( modulesDir, 'theme/assets/scss', 'theme.scss' ),
Expand Down

0 comments on commit 25f2d8f

Please sign in to comment.