BlockAnchorSupportService.php
1 year ago
BlockPatternsService.php
1 year ago
BlockService.php
1 year ago
BlockServiceProvider.php
1 year ago
BlockStylesService.php
1 year ago
BlockValidationService.php
2 years ago
CartMenuIconMigrationService.php
1 year ago
CartMigrationService.php
1 year ago
FormModeSwitcherService.php
1 year ago
ProductCollectionBadgesMigrationService.php
1 year ago
ProductListMigrationService.php
1 year ago
ProductListService.php
1 year ago
ProductPageBlocksMigrationService.php
1 year ago
ProductPriceChoicesMigrationService.php
1 year ago
ProductSelectedPriceMigrationService.php
1 year ago
ProductVariantsMigrationService.php
1 year ago
URLParamService.php
1 year ago
CartMenuIconMigrationService.php
53 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\BlockLibrary; |
| 4 | |
| 5 | /** |
| 6 | * Provide cart menu icon migration functionality. |
| 7 | */ |
| 8 | class CartMenuIconMigrationService { |
| 9 | /** |
| 10 | * Attributes. |
| 11 | * |
| 12 | * @var string |
| 13 | */ |
| 14 | public array $attributes = array(); |
| 15 | |
| 16 | /** |
| 17 | * Block. |
| 18 | * |
| 19 | * @var string |
| 20 | */ |
| 21 | public ?object $block; |
| 22 | |
| 23 | /** |
| 24 | * Block HTML. |
| 25 | * |
| 26 | * @var string |
| 27 | */ |
| 28 | public string $block_html = ''; |
| 29 | |
| 30 | /** |
| 31 | * Set the initial variables. |
| 32 | * |
| 33 | * @param array $attributes Attributes. |
| 34 | * @param object $block Block. |
| 35 | */ |
| 36 | public function __construct( $attributes = array(), $block = null ) { |
| 37 | $this->attributes = $attributes; |
| 38 | $this->block = $block; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Render the new cart menu icon block. |
| 43 | * |
| 44 | * @return string |
| 45 | */ |
| 46 | public function render(): string { |
| 47 | $cart_menu_icon_block_attrs = wp_json_encode( $this->attributes, JSON_FORCE_OBJECT ); |
| 48 | $this->block_html .= '<!-- wp:surecart/cart-menu-icon-button ' . $cart_menu_icon_block_attrs . ' /-->'; |
| 49 | |
| 50 | return do_blocks( $this->block_html ); |
| 51 | } |
| 52 | } |
| 53 |