Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make admin extendable #255

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions inc/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ function gtmkit_admin_init(): void {
GeneralOptionsPage::register( $options, $util );
IntegrationsOptionsPage::register( $options, $util );
HelpOptionsPage::register( $options, $util );

do_action( 'gtmkit_admin_init', $options, $util );
}

/**
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Bugfixes:

Other:
* Require WooCommerce 7.6
* The admin is now more extendable

= 1.13.1 =

Expand Down
9 changes: 9 additions & 0 deletions src/Admin/OptionTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ public function get_label(): string {
return $this->label;
}

/**
* Gets the path of the view files.
*
* @return string The path.
*/
public function get_view_path(): string {
return (string) $this->get_argument( 'view_path', GTMKIT_PATH . 'src/views/tabs/' );
}

/**
* Retrieves whether the tab needs a save button.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/OptionTabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function get_tabs(): array {
* @return string
*/
public function get_tab_view( OptionTab $tab ): string {
return GTMKIT_PATH . 'src/views/tabs/' . $this->get_base() . '/' . $tab->get_name() . '.php';
return $tab->get_view_path() . $this->get_base() . '/' . $tab->get_name() . '.php';
}

/**
Expand Down