Automattic\WooCommerce\Internal\Admin\Logging

PageController::setup_screen_options()privateWC 1.0

Register screen options for the logging views.

Method of the class: PageController{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->setup_screen_options( $view ): void;
$view(string) (required)
The current view within the Logs tab.

PageController::setup_screen_options() code WC 9.3.3

private function setup_screen_options( string $view ): void {
	$handler    = $this->settings->get_default_handler();
	$list_table = null;

	switch ( $handler ) {
		case LogHandlerFileV2::class:
			if ( in_array( $view, array( 'list_files', 'search_results' ), true ) ) {
				$list_table = $this->get_list_table( $view );
			}
			break;
		case 'WC_Log_Handler_DB':
				$list_table = WC_Admin_Status::get_db_log_list_table();
			break;
	}

	if ( $list_table instanceof WP_List_Table ) {
		// Ensure list table columns are initialized early enough to enable column hiding, if available.
		$list_table->prepare_column_headers();

		add_screen_option(
			'per_page',
			array(
				'default' => $list_table->get_per_page_default(),
				'option'  => $list_table::PER_PAGE_USER_OPTION_KEY,
			)
		);
	}
}