Block.php
42 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCartBlocks\Blocks\Email; |
| 4 | |
| 5 | use SureCartBlocks\Blocks\BaseBlock; |
| 6 | /** |
| 7 | * Logout Button Block. |
| 8 | */ |
| 9 | class Block extends BaseBlock { |
| 10 | /** |
| 11 | * Render the block |
| 12 | * |
| 13 | * @param array $attributes Block attributes. |
| 14 | * @param string $content Post content. |
| 15 | * |
| 16 | * @return string |
| 17 | */ |
| 18 | public function render( $attributes, $content = '' ) { |
| 19 | $tracking_confirmation = \SureCart::settings()->get( 'tracking_confirmation', false ); |
| 20 | if ( $tracking_confirmation ) { |
| 21 | $tracking_confirmation_message = \SureCart::settings()->get( 'tracking_confirmation_message', esc_html__( 'Your email and cart are saved so we can send email reminders about this order.', 'surecart' ) ); |
| 22 | } |
| 23 | ob_start(); ?> |
| 24 | |
| 25 | <sc-customer-email |
| 26 | class="<?php echo esc_attr( $attributes['className'] ?? '' ); ?>" |
| 27 | label="<?php echo esc_attr( $attributes['label'] ?? '' ); ?>" |
| 28 | <?php echo ! empty( $attributes['placeholder'] ) ? 'placeholder="' . esc_attr( $attributes['placeholder'] ) . '"' : false; ?> |
| 29 | <?php echo ! empty( $attributes['help'] ) ? 'help="' . esc_attr( $attributes['help'] ) . '"' : false; ?> |
| 30 | <?php echo ! empty( $attributes['autofocus'] ) ? 'autofocus' : false; ?> |
| 31 | <?php echo ! empty( $tracking_confirmation_message ) ? 'tracking-confirmation-message="' . esc_attr( $tracking_confirmation_message ) . '"' : false; ?> |
| 32 | required |
| 33 | autocomplete='email' |
| 34 | inputmode='email' |
| 35 | > |
| 36 | </sc-customer-email> |
| 37 | |
| 38 | <?php |
| 39 | return ob_get_clean(); |
| 40 | } |
| 41 | } |
| 42 |