<?php
/**
 * Full-page access denied template.
 *
 * @package Polanger_Dashboard_Tools
 */

if ( ! defined( 'ABSPATH' ) ) {
  exit;
}

$pdt_content_visibility_context = isset( $pdt_content_visibility_context ) && is_array( $pdt_content_visibility_context )
  ? $pdt_content_visibility_context
  : array(
    'title'    => __( 'Access Restricted', 'polanger-admin-menu-manager' ),
    'message'  => PDT_Content_Visibility::get_default_denied_message(),
    'home_url' => home_url( '/' ),
  );
?><!doctype html>
<html <?php language_attributes(); ?>>
  <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <?php wp_head(); ?>
  </head>
  <body <?php body_class( 'pdt-content-visibility-template' ); ?>>
    <?php if ( function_exists( 'wp_body_open' ) ) : ?>
      <?php wp_body_open(); ?>
    <?php endif; ?>

    <main class="pdt-content-visibility-shell">
      <section class="pdt-content-visibility-shell__card" role="main" aria-labelledby="pdt-content-visibility-title">
        <div class="pdt-content-visibility-shell__eyebrow"><?php esc_html_e( 'Protected Content', 'polanger-admin-menu-manager' ); ?></div>
        <h1 id="pdt-content-visibility-title" class="pdt-content-visibility-shell__title"><?php echo esc_html( $pdt_content_visibility_context['title'] ); ?></h1>
        <div class="pdt-content-visibility-shell__message"><?php echo PDT_Content_Visibility::render_denied_message_markup( $pdt_content_visibility_context['message'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML and shortcodes are sanitized before rendering. ?></div>

        <div class="pdt-content-visibility-shell__actions">
          <a class="pdt-content-visibility-button pdt-content-visibility-button--primary" href="<?php echo esc_url( $pdt_content_visibility_context['home_url'] ); ?>">
            <?php esc_html_e( 'Go to homepage', 'polanger-admin-menu-manager' ); ?>
          </a>
        </div>
      </section>
    </main>

    <?php wp_footer(); ?>
  </body>
</html>
