| 1 |
<?php |
| 2 |
|
| 3 |
use ABlocks\Controls\Border; |
| 4 |
use ABlocks\Controls\Dimensions; |
| 5 |
use ABlocks\Controls\Alignment; |
| 6 |
use ABlocks\Controls\Range; |
| 7 |
use ABlocks\Controls\Typography; |
| 8 |
use ABlocks\Controls\TextShadow; |
| 9 |
use ABlocks\Controls\TextStroke; |
| 10 |
use ABlocks\Controls\Icon; |
| 11 |
|
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
$attributes = [ |
| 18 |
'block_id' => [ |
| 19 |
'type' => 'string', |
| 20 |
'default' => '' |
| 21 |
], |
| 22 |
'blockVersion' => array( |
| 23 |
'type' => 'number', |
| 24 |
'default' => '', |
| 25 |
), |
| 26 |
'currentPostID' => [ |
| 27 |
'type' => 'integer', |
| 28 |
'default' => '', |
| 29 |
], |
| 30 |
'searchTerm' => [ |
| 31 |
'type' => 'string', |
| 32 |
'default' => '', |
| 33 |
], |
| 34 |
'source' => [ |
| 35 |
'type' => 'string', |
| 36 |
'default' => 'any', |
| 37 |
], |
| 38 |
'isIcon' => [ |
| 39 |
'type' => 'string', |
| 40 |
'default' => 'icon', |
| 41 |
], |
| 42 |
'variant' => [ |
| 43 |
'type' => 'string', |
| 44 |
'default' => 'classic', |
| 45 |
], |
| 46 |
'allowCollapse' => [ |
| 47 |
'type' => 'boolean', |
| 48 |
'default' => false, |
| 49 |
], |
| 50 |
'position' => [ |
| 51 |
'type' => 'string', |
| 52 |
'default' => 'default' |
| 53 |
], |
| 54 |
'buttonText' => [ |
| 55 |
'type' => 'string', |
| 56 |
'default' => 'Search', |
| 57 |
], |
| 58 |
'buttonBgColor' => [ |
| 59 |
'type' => 'string', |
| 60 |
'default' => '', |
| 61 |
], |
| 62 |
'buttonBgColorH' => [ |
| 63 |
'type' => 'string', |
| 64 |
'default' => '', |
| 65 |
], |
| 66 |
'buttonTextColor' => [ |
| 67 |
'type' => 'string', |
| 68 |
'default' => '', |
| 69 |
], |
| 70 |
'buttonTextColorH' => [ |
| 71 |
'type' => 'string', |
| 72 |
'default' => '', |
| 73 |
], |
| 74 |
'placeholder' => [ |
| 75 |
'type' => 'string', |
| 76 |
'default' => 'Write anything...', |
| 77 |
], |
| 78 |
'placeholderColor' => [ |
| 79 |
'type' => 'string', |
| 80 |
'default' => 'gray', |
| 81 |
], |
| 82 |
'inputTextColor' => [ |
| 83 |
'type' => 'string', |
| 84 |
'default' => '#949494', |
| 85 |
], |
| 86 |
'inputBgColor' => [ |
| 87 |
'type' => 'string', |
| 88 |
'default' => '#FFFFFF', |
| 89 |
], |
| 90 |
'searchResTColor' => [ |
| 91 |
'type' => 'string', |
| 92 |
'default' => '#000000', |
| 93 |
], |
| 94 |
'loadingSpinnerColor' => [ |
| 95 |
'type' => 'string', |
| 96 |
'default' => '#fff', |
| 97 |
], |
| 98 |
]; |
| 99 |
|
| 100 |
$attributes = array_merge( |
| 101 |
$attributes, |
| 102 |
Alignment::get_attribute( 'buttonAlignment', false, [ 'value' => 'left' ] ), |
| 103 |
Typography::get_attribute( 'searchResTypography', true ), |
| 104 |
Typography::get_attribute( 'buttonTypography', true ), |
| 105 |
TextShadow::get_attribute( 'buttonTextShadow' ), |
| 106 |
TextStroke::get_attribute( 'buttonTextStroke', true ), |
| 107 |
Typography::get_attribute( 'buttonTypographyH', true ), |
| 108 |
TextShadow::get_attribute( 'buttonTextShadowH' ), |
| 109 |
TextStroke::get_attribute( 'buttonTextStrokeH', true ), |
| 110 |
Alignment::get_attribute( 'alignment', true, [ 'value' => 'left' ] ), |
| 111 |
Typography::get_attribute( 'inputTypography', true ), |
| 112 |
TextShadow::get_attribute( 'inputTextShadow' ), |
| 113 |
TextStroke::get_attribute( 'inputTextStroke', true ), |
| 114 |
Alignment::get_attribute( 'fullscreenButtonAlignment', true, [ 'value' => 'center' ] ), |
| 115 |
Alignment::get_attribute( 'horizontalAlignment', true, [ 'value' => 'left' ] ), |
| 116 |
Alignment::get_attribute( 'verticalAlignment', true, [ 'value' => 'top' ] ), |
| 117 |
Border::get_attribute( 'listBorder', true ), |
| 118 |
Border::get_attribute( 'itemBorder', true ), |
| 119 |
Border::get_attribute( 'searchBoxBorder', true ), |
| 120 |
Dimensions::get_attribute( 'listPadding', true ), |
| 121 |
Dimensions::get_attribute( 'itemPadding', true ), |
| 122 |
Range::get_attribute( [ |
| 123 |
'attributeName' => 'gap', |
| 124 |
'attributeObjectKey' => 'value', |
| 125 |
'isResponsive' => true, |
| 126 |
'defaultValue' => 0, |
| 127 |
'defaultValueMobile' => 0, |
| 128 |
'defaultValueTablet' => 0, |
| 129 |
'hasUnit' => true, |
| 130 |
'unitDefaultValue' => 'px', |
| 131 |
] ), |
| 132 |
Range::get_attribute( [ |
| 133 |
'attributeName' => 'listGap', |
| 134 |
'attributeObjectKey' => 'value', |
| 135 |
'isResponsive' => true, |
| 136 |
'defaultValue' => '', |
| 137 |
'hasUnit' => true, |
| 138 |
'unitDefaultValue' => 'px', |
| 139 |
] ), |
| 140 |
Range::get_attribute( [ |
| 141 |
'attributeName' => 'iconWidth', |
| 142 |
'attributeObjectKey' => 'value', |
| 143 |
'isResponsive' => true, |
| 144 |
'defaultValue' => 18, |
| 145 |
'defaultValueMobile' => 18, |
| 146 |
'defaultValueTablet' => 12, |
| 147 |
'hasUnit' => true, |
| 148 |
'unitDefaultValue' => 'px', |
| 149 |
] ), |
| 150 |
Range::get_attribute( [ |
| 151 |
'attributeName' => 'searchItemHeight', |
| 152 |
'attributeObjectKey' => 'value', |
| 153 |
'isResponsive' => true, |
| 154 |
'defaultValue' => 300, |
| 155 |
'defaultValueMobile' => 300, |
| 156 |
'defaultValueTablet' => 300, |
| 157 |
'hasUnit' => true, |
| 158 |
'unitDefaultValue' => 'px', |
| 159 |
] ), |
| 160 |
Range::get_attribute( [ |
| 161 |
'attributeName' => 'searchBtnWidth', |
| 162 |
'attributeObjectKey' => 'value', |
| 163 |
'isResponsive' => true, |
| 164 |
'defaultValue' => 70, |
| 165 |
'defaultValueMobile' => 70, |
| 166 |
'defaultValueTablet' => 70, |
| 167 |
'hasUnit' => true, |
| 168 |
'unitDefaultValue' => 'px', |
| 169 |
] ), |
| 170 |
Range::get_attribute( [ |
| 171 |
'attributeName' => 'listWidth', |
| 172 |
'attributeObjectKey' => 'value', |
| 173 |
'isResponsive' => true, |
| 174 |
'defaultValue' => '', |
| 175 |
'hasUnit' => true, |
| 176 |
'unitDefaultValue' => '%', |
| 177 |
] ), |
| 178 |
Range::get_attribute( [ |
| 179 |
'attributeName' => 'itemWidth', |
| 180 |
'attributeObjectKey' => 'value', |
| 181 |
'isResponsive' => true, |
| 182 |
'defaultValue' => '', |
| 183 |
'hasUnit' => true, |
| 184 |
'unitDefaultValue' => 'px', |
| 185 |
] ), |
| 186 |
Range::get_attribute( [ |
| 187 |
'attributeName' => 'itemGap', |
| 188 |
'attributeObjectKey' => 'value', |
| 189 |
'isResponsive' => true, |
| 190 |
'defaultValue' => '', |
| 191 |
'hasUnit' => true, |
| 192 |
'unitDefaultValue' => 'px', |
| 193 |
] ), |
| 194 |
Range::get_attribute( [ |
| 195 |
'attributeName' => 'horizontalOffset', |
| 196 |
'attributeObjectKey' => 'value', |
| 197 |
'isResponsive' => true, |
| 198 |
'defaultValue' => 230, |
| 199 |
'defaultValueMobile' => 230, |
| 200 |
'defaultValueTablet' => 230, |
| 201 |
'hasUnit' => true, |
| 202 |
'unitDefaultValue' => 'px', |
| 203 |
] ), |
| 204 |
Range::get_attribute( [ |
| 205 |
'attributeName' => 'verticalOffset', |
| 206 |
'attributeObjectKey' => 'value', |
| 207 |
'isResponsive' => true, |
| 208 |
'defaultValue' => 230, |
| 209 |
'defaultValueMobile' => 230, |
| 210 |
'defaultValueTablet' => 230, |
| 211 |
'hasUnit' => true, |
| 212 |
'unitDefaultValue' => 'px', |
| 213 |
] ), |
| 214 |
); |
| 215 |
|
| 216 |
return array_merge( $attributes, \ABlocks\Classes\BlockGlobal::get_attributes() ); |
| 217 |
|
| 218 |
|