id = 'webhooks'; $this->label = __( 'Webhooks', 'woocommerce' ); add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); add_action( 'woocommerce_settings_' . $this->id, array( $this, 'output' ) ); add_action( 'woocommerce_settings_form_method_tab_' . $this->id, array( $this, 'form_method' ) ); $this->notices(); } /** * Form method * * @param string $method * * @return string */ public function form_method( $method ) { return 'get'; } /** * Notices. */ protected function notices() { if ( isset( $_GET['trashed'] ) ) { $trashed = absint( $_GET['trashed'] ); WC_Admin_Settings::add_message( sprintf( _n( '1 webhook moved to the Trash.', '%d webhooks moved to the Trash.', $trashed, 'woocommerce' ), $trashed ) ); } } /** * Table list output */ protected function table_list_output() { $webhooks_table_list = new WC_Admin_Webhooks_Table_List(); $webhooks_table_list->prepare_items(); echo ''; echo ''; $webhooks_table_list->display(); } /** * Output the settings */ public function output() { global $current_section; // Hide the save button $GLOBALS['hide_save_button'] = true; // Display the table list. $this->table_list_output(); } } endif; return new WC_Settings_Webhooks();