Settings::include_admin_bar_test_mode( WP_Admin_Bar $wp_admin_bar )

Display admin bar when using the Test Mode for payments.


Parameters

$wp_admin_bar

(WP_Admin_Bar) (Required) WP_Admin_Bar instance, passed by reference.


Top ↑

Return

(bool)


Top ↑

Source

File: src/Tickets/Commerce/Settings.php

	public function include_admin_bar_test_mode( WP_Admin_Bar $wp_admin_bar ) {
		if (
			! $this->is_sandbox() ||
			! current_user_can( 'manage_options' )
		) {
			return false;
		}
		$url = \Tribe__Settings::instance()->get_url( [ 'tab' => 'payments' ] );

		// Add the main site admin menu item.
		$wp_admin_bar->add_menu(
			[
				'id'     => 'tec-tickets-commerce-sandbox-notice',
				'href'   => $url,
				'parent' => 'top-secondary',
				'title'  => __( 'Tickets Commerce Test Mode Active', 'event-tickets' ),
				'meta'   => [
					'class' => 'tec-tickets-commerce-sandbox-mode-active',
				],
			]
		);

		// Force this asset to load whn we add this to the menu.
		tribe_asset_enqueue( 'tec-tickets-commerce-gateway-paypal-global-admin-styles' );

		return true;
	}

Top ↑

Changelog

Changelog
Version Description
5.2.0 Introduced.