core = $core; add_action( 'woocommerce_checkout_after_order_review', array( $this, 'extend_checkout_page_form' ) ); add_action( 'woocommerce_after_checkout_form', array( $this, 'extend_checkout_page_bottom' ) ); } /** * Get additional HTML code for checkout form. */ public function extend_checkout_page_form() { echo ''; } /** * Extend_checkout_page_bottom. * * Check and embed code for modal if needed on checkout page. */ public function extend_checkout_page_bottom() { $config = $this->core->get_config_for_currency(); $config->access_mode_to_strict(); if ( $config->get_p24_payinshop() ) { $display_terms = $config->get_p24_acceptinshop(); self::echo_modal_html( $display_terms ); } } /** * Get HTML code for modal * * @param bool $need_terms If checkbox to show terms is needed. Default to false. * * @return string */ public static function get_modal_html( $need_terms = false ) { $header = esc_html( __( 'Wprowadź kod BLIK', 'przelewy24' ) ); $label = esc_html( __( 'Wprowadź 6-cyfrowy kod BLIK pobrany z aplikacji bankowej.', 'przelewy24' ) ); $error = esc_html( __( 'Niepoprawny kod BLIK.', 'przelewy24' ) ); $unccepted = esc_html( __( 'Brak zaakceptowanego regulaminu Przelewy24.', 'przelewy24' ) ); $button = esc_html( __( 'Zapłać', 'przelewy24' ) ); $terms_prefix = esc_html( __( 'Tak, przeczytałem i akceptuję', 'przelewy24' ) ); $terms_link = esc_html( __( 'regulamin Przelewy24', 'przelewy24' ) ); if ( $need_terms ) { $terms_input = <<

$unccepted

TERMS; } else { $terms_input = "\n"; } return <<

$header

$label

$error

$terms_input

MODAL; } /** * Echo HTML code for modal * * @param bool $need_terms If checkbox to show terms is needed. Default to false. */ public static function echo_modal_html( $need_terms = false ) { echo self::get_modal_html( $need_terms ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } }