Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoladj77 committed Jan 12, 2025
1 parent 3a2998b commit e24dea2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions modules/template-parts/classes/sources/source-remote-ehp.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

namespace HelloPlus\Modules\TemplateParts\Classes\Sources;

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}

class Source_Remote_Ehp extends \Elementor\TemplateLibrary\Source_Remote {

const API_TEMPLATES_URL = 'https://my.stg.elementor.red/api/connect/v1/library/templates?products=ehp';
Expand Down
9 changes: 9 additions & 0 deletions modules/template-parts/components/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
}

use Elementor\Core\Documents_Manager;
use HelloPlus\Includes\Utils;

/**
* class Document
Expand Down Expand Up @@ -46,7 +47,15 @@ public function register( Documents_Manager $documents_manager ) {
}
}


public function register_remote_source() {
Utils::elementor()->templates_manager->register_source(
'HelloPlus\Modules\TemplateParts\Classes\Sources\Source_Remote_Ehp'
);
}

public function __construct() {
add_action( 'elementor/documents/register', [ $this, 'register' ] );
add_action( 'elementor/init', [ $this, 'register_remote_source' ] );
}
}
2 changes: 1 addition & 1 deletion modules/template-parts/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function enqueue_editor_scripts(): void {
wp_enqueue_script(
'helloplus-editor',
HELLOPLUS_SCRIPTS_URL . 'helloplus-editor.js',
[ 'elementor-v2-ui', 'elementor-editor' ],
[ 'elementor-editor' ],
HELLOPLUS_VERSION,
true
);
Expand Down
7 changes: 0 additions & 7 deletions modules/theme/components/theme-overrides.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ public function admin_config( array $config ): array {
return $config;
}

public function register_remote_source() {
Utils::elementor()->templates_manager->register_source(
'HelloPlus\Modules\TemplateParts\Classes\Sources\Source_Remote_Ehp'
);
}

public function localize_settings( $data ) {
$data['close_modal_redirect_hello_plus'] = admin_url( 'admin.php?page=hello-biz' );

Expand All @@ -60,7 +54,6 @@ public function __construct() {
add_filter( 'hello-plus-theme/settings/hello_style', '__return_false' );
add_filter( 'hello-plus-theme/customizer/enable', Setup_Wizard::has_site_wizard_been_completed() ? '__return_false' : '__return_true' );
add_filter( 'hello-plus-theme/rest/admin-config', [ $this, 'admin_config' ] );
add_action( 'elementor/init', [ $this, 'register_remote_source' ] );
add_action( 'elementor/editor/localize_settings', [ $this, 'localize_settings' ] );
}
}

0 comments on commit e24dea2

Please sign in to comment.