クラス
CartErrorPage
Error page HTML generation methods
ソース ソース
ファイル: src/Views/CartErrorPage/CartErrorPage.php
class CartErrorPage { /** * Registers hooks * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return void */ public function init() { $enqueue = function () { wp_enqueue_style( 'wcexaap-cart-error-page', WCEXAAP_PLUGIN_URL . '/src/Views/CartErrorPage/style.css', [], WCEXAAP_VERSION ); }; (new ConditionalAssetsLoader())->loadCartErrorPageAssets($enqueue); } /** * Returns error page HTML for when checkout fails * * @author Evan D Shaw <evandanielshaw@gmail.com> * @param string $html * @param GenericError $error * @return string */ public function getErrorPageHtml($html, GenericError $error) { ob_start(); ?> <div class="error_page_message"> <h4><?php _e('The following errors occured:', 'wcexaap'); ?></h4> <p><span class="reasonCode">- <?php echo esc_html($error->errorname); ?></span>: <?php echo esc_html($error->message); ?></p> </div> <?php $ehtml = ob_get_contents(); ob_end_clean(); $html .= $ehtml; return $html; } }
- getErrorPageHtml — Returns error page HTML for when checkout fails
- init — Registers hooks