Skip to content

Commit ad13b9e

Browse files
committed
Fix delete
1 parent 6dd6470 commit ad13b9e

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

plugins/wp-graphql-headless-webhooks/assets/js/admin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
'click',
1212
function () {
1313
var headerRow = $( wpGraphQLWebhooks.headerTemplate || wpGraphQLWebhooks.headerRowTemplate );
14-
$( '#webhook-headers-container, #webhook-headers' ).append( headerRow );
14+
$( '#webhook-headers-container' ).append( headerRow );
1515
}
1616
);
1717

plugins/wp-graphql-headless-webhooks/src/Admin/WebhooksAdmin.php

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,19 @@ public function __construct( WebhookRepositoryInterface $repository ) {
5151
}
5252

5353
/**
54-
* Optionally initialize additional admin hooks.
55-
*
56-
* @return void
57-
*/
58-
public function init(): void {
59-
add_action( 'admin_init', [ $this, 'handle_actions' ] );
60-
}
61-
62-
/**
63-
* Registers the top-level "Webhooks" admin menu.
54+
* Registers the webhooks submenu under the GraphQL admin menu.
6455
*
6556
* @return void
6657
*/
6758
public function add_admin_menu(): void {
68-
add_menu_page(
69-
__( 'Webhooks', 'wp-graphql-headless-webhooks' ),
59+
// Add submenu under GraphQL menu using the correct parent slug
60+
add_submenu_page(
61+
'graphiql-ide',
62+
__( 'GraphQL Webhooks', 'wp-graphql-headless-webhooks' ),
7063
__( 'Webhooks', 'wp-graphql-headless-webhooks' ),
7164
'manage_options',
7265
self::ADMIN_PAGE_SLUG,
73-
[ $this, 'render_admin_page' ],
74-
'dashicons-rss',
75-
25
66+
[ $this, 'render_admin_page' ]
7667
);
7768
}
7869

@@ -97,6 +88,11 @@ public function get_admin_url( array $args = [] ): string {
9788
* @return void
9889
*/
9990
public function enqueue_assets( string $hook ): void {
91+
// Only enqueue on our admin page
92+
if ( false === strpos( $hook, self::ADMIN_PAGE_SLUG ) ) {
93+
return;
94+
}
95+
10096
wp_enqueue_style(
10197
'graphql-webhooks-admin',
10298
WPGRAPHQL_HEADLESS_WEBHOOKS_PLUGIN_URL . 'assets/css/admin.css',

plugins/wp-graphql-headless-webhooks/src/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private function setup(): void {
9696

9797
if ( class_exists( 'WPGraphQL\Webhooks\Admin\WebhooksAdmin' ) ) {
9898
$admin = new \WPGraphQL\Webhooks\Admin\WebhooksAdmin( $repository );
99-
$admin->init();
99+
// The constructor already sets up all necessary hooks
100100
}
101101
}
102102

0 commit comments

Comments
 (0)