← All changes
|
includes/blocks/storeengine-products/attributes.php
+164
-0
2.7.6
→
2.14.0
View file →
| @@ -1,0 +1,164 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +use ABlocks\Controls\Typography; | |
| 4 | +use ABlocks\Controls\Background; | |
| 5 | +use ABlocks\Controls\Border; | |
| 6 | +use ABlocks\Controls\Dimensions; | |
| 7 | +use ABlocks\Controls\Range; | |
| 8 | +use ABlocks\Controls\Alignment; | |
| 9 | + | |
| 10 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 11 | + exit; | |
| 12 | +} | |
| 13 | + | |
| 14 | +$attributes = [ | |
| 15 | + 'block_id' => [ | |
| 16 | + 'type' => 'string', | |
| 17 | + 'default' => '', | |
| 18 | + ], | |
| 19 | + 'products_ids' => [ | |
| 20 | + 'type' => 'array', | |
| 21 | + 'default' => [], | |
| 22 | + ], | |
| 23 | + 'products_categories' => [ | |
| 24 | + 'type' => 'array', | |
| 25 | + 'default' => [], | |
| 26 | + ], | |
| 27 | + 'products_tags' => [ | |
| 28 | + 'type' => 'array', | |
| 29 | + 'default' => [], | |
| 30 | + ], | |
| 31 | + 'products_exclude_ids' => [ | |
| 32 | + 'type' => 'array', | |
| 33 | + 'default' => [], | |
| 34 | + ], | |
| 35 | + 'products_exclude_categories' => [ | |
| 36 | + 'type' => 'array', | |
| 37 | + 'default' => [], | |
| 38 | + ], | |
| 39 | + 'products_exclude_tags' => [ | |
| 40 | + 'type' => 'array', | |
| 41 | + 'default' => [], | |
| 42 | + ], | |
| 43 | + 'category_color' => [ | |
| 44 | + 'type' => 'string', | |
| 45 | + 'default' => '#000', | |
| 46 | + ], | |
| 47 | + 'category_hover_color' => [ | |
| 48 | + 'type' => 'string', | |
| 49 | + 'default' => '#000', | |
| 50 | + ], | |
| 51 | + | |
| 52 | + 'products_count' => [ | |
| 53 | + 'type' => 'number', | |
| 54 | + 'default' => 3, | |
| 55 | + ], | |
| 56 | + 'products_columns' => [ | |
| 57 | + 'type' => 'number', | |
| 58 | + 'default' => 3, | |
| 59 | + ], | |
| 60 | + 'show_pagination' => [ | |
| 61 | + 'type' => 'boolean', | |
| 62 | + 'default' => true, | |
| 63 | + ], | |
| 64 | + 'difficulty_levels' => [ | |
| 65 | + 'type' => 'array', | |
| 66 | + 'default' => [], | |
| 67 | + ], | |
| 68 | + 'price_types' => [ | |
| 69 | + 'type' => 'array', | |
| 70 | + 'default' => [], | |
| 71 | + ], | |
| 72 | + 'cart_button_color' => [ | |
| 73 | + 'type' => 'string', | |
| 74 | + 'default' => '', | |
| 75 | + ], | |
| 76 | + 'cart_button_hover_color' => [ | |
| 77 | + 'type' => 'string', | |
| 78 | + 'default' => '', | |
| 79 | + ], | |
| 80 | + 'cart_button_text_color' => [ | |
| 81 | + 'type' => 'string', | |
| 82 | + 'default' => '', | |
| 83 | + ], | |
| 84 | + 'cart_button_text_hover_color' => [ | |
| 85 | + 'type' => 'string', | |
| 86 | + 'default' => '', | |
| 87 | + ], | |
| 88 | + 'cart_button_transition' => [ | |
| 89 | + 'type' => 'number', | |
| 90 | + 'default' => 0, | |
| 91 | + ], | |
| 92 | + 'order_by' => [ | |
| 93 | + 'type' => 'string', | |
| 94 | + 'default' => 'date', | |
| 95 | + ], | |
| 96 | + 'products_order' => [ | |
| 97 | + 'type' => 'string', | |
| 98 | + 'default' => 'DESC', | |
| 99 | + ], | |
| 100 | + 'title_color' => [ | |
| 101 | + 'type' => 'string', | |
| 102 | + 'default' => '#000', | |
| 103 | + ], | |
| 104 | + 'title_hover_color' => [ | |
| 105 | + 'type' => 'string', | |
| 106 | + 'default' => '', | |
| 107 | + ], | |
| 108 | + 'price_color' => [ | |
| 109 | + 'type' => 'string', | |
| 110 | + 'default' => '', | |
| 111 | + ], | |
| 112 | + 'price_hover_color' => [ | |
| 113 | + 'type' => 'string', | |
| 114 | + 'default' => '', | |
| 115 | + ], | |
| 116 | +]; | |
| 117 | + | |
| 118 | +$attributes = array_merge( | |
| 119 | + $attributes, | |
| 120 | + Typography::get_attribute( 'cat_typography', true ), | |
| 121 | + Typography::get_attribute( 'cart_button_typography', true ), | |
| 122 | + Typography::get_attribute( 'title_typography', true ), | |
| 123 | + Typography::get_attribute( 'author_typography', true ), | |
| 124 | + Typography::get_attribute( 'rating_typography', true ), | |
| 125 | + Typography::get_attribute( 'price_typography', true ), | |
| 126 | + Background::get_attribute( 'card_background', true ), | |
| 127 | + Border::get_attribute( 'card_border', true ), | |
| 128 | + Border::get_attribute( 'cart_border', true ), | |
| 129 | + Dimensions::get_attribute( 'card_margin', true ), | |
| 130 | + Dimensions::get_attribute( 'card_hover_margin', true ), | |
| 131 | + Dimensions::get_attribute( 'card_padding', true ), | |
| 132 | + Dimensions::get_attribute( 'card_hover_padding', true ), | |
| 133 | + Background::get_attribute( 'wish_icon_background', true ), | |
| 134 | + Background::get_attribute( 'wish_icon_background', true ), | |
| 135 | + Alignment::get_attribute( 'titleTextAlign', true, [ 'value' => 'center' ] ), | |
| 136 | + Alignment::get_attribute( 'priceTextAlign', true, [ 'value' => 'center' ] ), | |
| 137 | + Range::get_attribute([ | |
| 138 | + 'attributeName' => 'buttonWidth', | |
| 139 | + 'attributeObjectKey' => 'value', | |
| 140 | + 'isResponsive' => true, | |
| 141 | + 'defaultValue' => 100, | |
| 142 | + 'hasUnit' => false, | |
| 143 | + 'unitDefaultValue' => '%', | |
| 144 | + ]), | |
| 145 | + Range::get_attribute([ | |
| 146 | + 'attributeName' => 'buttonDriection', | |
| 147 | + 'attributeObjectKey' => 'value', | |
| 148 | + 'isResponsive' => true, | |
| 149 | + 'defaultValue' => 'column', | |
| 150 | + 'hasUnit' => false, | |
| 151 | + 'unitDefaultValue' => '', | |
| 152 | + ]), | |
| 153 | + Range::get_attribute([ | |
| 154 | + 'attributeName' => 'buttonGap', | |
| 155 | + 'attributeObjectKey' => 'value', | |
| 156 | + 'isResponsive' => true, | |
| 157 | + 'defaultValue' => 8, | |
| 158 | + 'hasUnit' => false, | |
| 159 | + // 'unitDefaultValue' => 'px', | |
| 160 | + ]), | |
| 161 | +); | |
| 162 | + | |
| 163 | +return array_merge( $attributes, \ABlocks\Classes\BlockGlobal::get_attributes() ); | |
| 164 | + | |