| @@ -1,0 +1,160 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 4 | + exit; | |
| 5 | +} | |
| 6 | + | |
| 7 | +use ABlocks\Controls\Border; | |
| 8 | +use ABlocks\Controls\Dimensions; | |
| 9 | +use ABlocks\Controls\Typography; | |
| 10 | +use ABlocks\Controls\TextShadow; | |
| 11 | +use ABlocks\Controls\Alignment; | |
| 12 | +use ABlocks\Controls\Link; | |
| 13 | +use ABlocks\Helper; | |
| 14 | +use ABlocks\Controls\BoxShadow; | |
| 15 | +use ABlocks\Controls\Icon; | |
| 16 | +use ABlocks\Controls\Range; | |
| 17 | + | |
| 18 | +$attributes = [ | |
| 19 | + 'block_id' => [ | |
| 20 | + 'type' => 'string', | |
| 21 | + 'default' => '', | |
| 22 | + ], | |
| 23 | + 'blockVersion' => array( | |
| 24 | + 'type' => 'number', | |
| 25 | + 'default' => '', | |
| 26 | + ), | |
| 27 | + 'postId' => [ | |
| 28 | + 'type' => 'number', | |
| 29 | + 'default' => '', | |
| 30 | + ], | |
| 31 | + 'text' => [ | |
| 32 | + 'type' => 'string', | |
| 33 | + 'default' => 'Buy now', | |
| 34 | + ], | |
| 35 | + 'buttonType' => [ | |
| 36 | + 'type' => 'string', | |
| 37 | + 'default' => '#635bff', | |
| 38 | + ], | |
| 39 | + 'buttonSize' => [ | |
| 40 | + 'type' => 'string', | |
| 41 | + 'default' => 'md', | |
| 42 | + ], | |
| 43 | + 'textColor' => [ | |
| 44 | + 'type' => 'string', | |
| 45 | + 'default' => '#FFFFFF', | |
| 46 | + ], | |
| 47 | + 'textColorH' => [ | |
| 48 | + 'type' => 'string', | |
| 49 | + 'default' => '', | |
| 50 | + ], | |
| 51 | + 'background' => [ | |
| 52 | + 'type' => 'string', | |
| 53 | + 'default' => '', | |
| 54 | + ], | |
| 55 | + 'backgroundH' => [ | |
| 56 | + 'type' => 'string', | |
| 57 | + 'default' => '', | |
| 58 | + ], | |
| 59 | + 'transition' => [ | |
| 60 | + 'type' => 'number', | |
| 61 | + 'default' => '', | |
| 62 | + ], | |
| 63 | + 'showIcon' => [ | |
| 64 | + 'type' => 'boolean', | |
| 65 | + 'default' => true, | |
| 66 | + ], | |
| 67 | + 'iconPosition' => [ | |
| 68 | + 'type' => 'string', | |
| 69 | + 'default' => 'left', | |
| 70 | + ], | |
| 71 | + | |
| 72 | + // Stripe Pricing & Payments | |
| 73 | + 'stripeApi' => [ | |
| 74 | + 'type' => 'string', | |
| 75 | + 'default' => '', | |
| 76 | + ], | |
| 77 | + 'itemName' => [ | |
| 78 | + 'type' => 'string', | |
| 79 | + 'default' => '', | |
| 80 | + ], | |
| 81 | + 'price' => [ | |
| 82 | + 'type' => 'number', | |
| 83 | + 'default' => '0', | |
| 84 | + ], | |
| 85 | + 'currency' => [ | |
| 86 | + 'type' => 'string', | |
| 87 | + 'default' => 'USD', | |
| 88 | + ], | |
| 89 | + 'quantity' => [ | |
| 90 | + 'type' => 'number', | |
| 91 | + 'default' => '0', | |
| 92 | + ], | |
| 93 | + 'shippingPrice' => [ | |
| 94 | + 'type' => 'number', | |
| 95 | + 'default' => '0', | |
| 96 | + ], | |
| 97 | + 'hasTax' => [ | |
| 98 | + 'type' => 'boolean', | |
| 99 | + 'default' => false, | |
| 100 | + ], | |
| 101 | + 'tax' => [ | |
| 102 | + 'type' => 'array', | |
| 103 | + 'default' => [], | |
| 104 | + ], | |
| 105 | + 'taxId' => [ | |
| 106 | + 'type' => 'string', | |
| 107 | + 'default' => '', | |
| 108 | + ], | |
| 109 | + | |
| 110 | + // Stripe Additional Options | |
| 111 | + 'redirectionAfterPayment' => [ | |
| 112 | + 'type' => 'string', | |
| 113 | + 'default' => '', | |
| 114 | + ], | |
| 115 | + 'openInNewTab' => [ | |
| 116 | + 'type' => 'boolean', | |
| 117 | + 'default' => true, | |
| 118 | + ], | |
| 119 | + 'customMessage' => [ | |
| 120 | + 'type' => 'boolean', | |
| 121 | + 'default' => false, | |
| 122 | + ], | |
| 123 | + 'errorMessage' => [ | |
| 124 | + 'type' => 'string', | |
| 125 | + 'default' => 'No payment method connected. Contact seller.', | |
| 126 | + ] | |
| 127 | + | |
| 128 | +]; | |
| 129 | + | |
| 130 | + | |
| 131 | +$attributes = array_merge( | |
| 132 | + $attributes, | |
| 133 | + Icon::get_attribute( 'icon', [ | |
| 134 | + 'size' => '16', | |
| 135 | + 'className' => 'fab fa-stripe', | |
| 136 | + 'path' => 'M155.3 154.6c0-22.3 18.6-30.9 48.4-30.9 43.4 0 98.5 13.3 141.9 36.7V26.1C298.3 7.2 251.1 0 203.8 0 88.1 0 11 60.4 11 161.4c0 157.9 216.8 132.3 216.8 200.4 0 26.4-22.9 34.9-54.7 34.9-47.2 0-108.2-19.5-156.1-45.5v128.5a396.09 396.09 0 0 0 156 32.4c118.6 0 200.3-51 200.3-153.6 0-170.2-218-139.7-218-203.9z', | |
| 137 | + 'viewBox' => '0 0 384 512', | |
| 138 | + 'iconType' => 'default', | |
| 139 | + 'color' => '#ffffff', | |
| 140 | + ] ), | |
| 141 | + Link::get_attribute( 'link' ), | |
| 142 | + Border::get_attribute( 'border', true ), | |
| 143 | + Dimensions::get_attribute( 'padding', true ), | |
| 144 | + Typography::get_attribute( 'typography', true ), | |
| 145 | + TextShadow::get_attribute( 'textShadow' ), | |
| 146 | + Alignment::get_attribute( 'position', true, [ 'value' => 'left' ] ), | |
| 147 | + Alignment::get_attribute( 'alignment', true, [ 'value' => 'left' ] ), | |
| 148 | + BoxShadow::get_attribute( 'boxShadow', true ), | |
| 149 | + Range::get_attribute([ | |
| 150 | + 'attributeName' => 'iconSpace', | |
| 151 | + 'attributeObjectKey' => 'value', | |
| 152 | + 'isResponsive' => true, | |
| 153 | + 'defaultValue' => 10, | |
| 154 | + 'hasUnit' => true, | |
| 155 | + 'unitDefaultValue' => 'px', | |
| 156 | + ]), | |
| 157 | +); | |
| 158 | + | |
| 159 | +return array_merge( $attributes, \ABlocks\Classes\BlockGlobal::get_attributes() ); | |
| 160 | + | |