Amp_Admin_Notices::render_amp_admin_notices()

Summary

Displays an admin notice if AMP is active an SSL is not enabled.


Source

File: src/BigCommerce/Amp/Amp_Admin_Notices.php

	public function render_amp_admin_notices() {
		if ( ! $this->amp_is_enabled ) {
			return;
		}

		$screen = get_current_screen();
		if ( ! is_a( $screen, WP_Screen::class ) || $this->screen_id !== $screen->id ) {
			return;
		}

		$this->ssl_notice();

		/**
		 * Filters AMP admin notices.
		 *
		 * @param array Array of string messages.
		 */
		if ( empty( apply_filters( 'bigcommerce/amp/admin_notices', $this->notices ) ) ) {
			return;
		}

		$list = sprintf(
			'<ul class="bigcommerce-notice__list">%s</ul>',
			implode(
				'',
				array_map(
					function ( $message ) {
						return sprintf( '<li class="bigcommerce-notice__list-item">%s</li>', $message );
					},
					$this->notices
				)
			)
		);

		echo wp_kses_post(
			sprintf(
				'<div class="notice notice-error bigcommerce-notice"><h3 class="bigcommerce-notice__heading">%s</h3>%s</div>',
				__( 'AMP and BigCommerce', 'bigcommerce' ),
				$list
			)
		);
	}


User Contributed Notes

You must log in before being able to contribute a note or feedback.