| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
use ABlocks\Controls\Alignment; |
| 8 |
use ABlocks\Controls\Typography; |
| 9 |
use ABlocks\Controls\Range; |
| 10 |
use ABlocks\Controls\Dimensions; |
| 11 |
use ABlocks\Controls\Border; |
| 12 |
use ABlocks\Components\ButtonGroup; |
| 13 |
|
| 14 |
$attributes = [ |
| 15 |
'block_id' => [ |
| 16 |
'type' => 'string', |
| 17 |
'default' => '' |
| 18 |
], |
| 19 |
'blockVersion' => array( |
| 20 |
'type' => 'number', |
| 21 |
'default' => '', |
| 22 |
), |
| 23 |
'isSwitch' => [ |
| 24 |
'type' => 'boolean', |
| 25 |
'default' => false, |
| 26 |
], |
| 27 |
'leftLabel' => [ |
| 28 |
'type' => 'string', |
| 29 |
'default' => 'Monthly', |
| 30 |
], |
| 31 |
'rightLabel' => [ |
| 32 |
'type' => 'string', |
| 33 |
'default' => 'Yearly', |
| 34 |
], |
| 35 |
'toggleBarBgColor' => [ |
| 36 |
'type' => 'string', |
| 37 |
'default' => '' |
| 38 |
], |
| 39 |
'labelNormalColor' => [ |
| 40 |
'type' => 'string', |
| 41 |
'default' => 'black', |
| 42 |
], |
| 43 |
'labelActiveColor' => [ |
| 44 |
'type' => 'string', |
| 45 |
'default' => '#562DD4', |
| 46 |
], |
| 47 |
'toggleNormalColor' => [ |
| 48 |
'type' => 'string', |
| 49 |
'default' => 'white', |
| 50 |
], |
| 51 |
'toggleNormalBgColor' => [ |
| 52 |
'type' => 'string', |
| 53 |
'default' => '#562DD4', |
| 54 |
], |
| 55 |
'toggleActiveColor' => [ |
| 56 |
'type' => 'string', |
| 57 |
'default' => 'white', |
| 58 |
], |
| 59 |
'toggleActiveBgColor' => [ |
| 60 |
'type' => 'string', |
| 61 |
'default' => '#d4552d', |
| 62 |
], |
| 63 |
]; |
| 64 |
|
| 65 |
$attributes = array_merge( |
| 66 |
$attributes, |
| 67 |
Alignment::get_attribute( 'alignment', true, [ 'value' => 'center' ] ), |
| 68 |
Typography::get_attribute( 'labelTypography', true ), |
| 69 |
Dimensions::get_attribute( 'toggleBarPadding', true ), |
| 70 |
Border::get_attribute( 'toggleBarBorder', true ), |
| 71 |
ButtonGroup::get_attribute( 'toggleDirection', false, [ |
| 72 |
'value' => 'row', |
| 73 |
] ), |
| 74 |
ButtonGroup::get_attribute( 'labelColorState', false, [ |
| 75 |
'value' => 'normal', |
| 76 |
] ), |
| 77 |
ButtonGroup::get_attribute( 'toggleColorState', false, [ |
| 78 |
'value' => 'normal', |
| 79 |
] ), |
| 80 |
Range::get_attribute([ |
| 81 |
'attributeName' => 'space', |
| 82 |
'isResponsive' => true, |
| 83 |
'attributeObjectKey' => 'value', |
| 84 |
'defaultValue' => 10, |
| 85 |
'hasUnit' => false, |
| 86 |
]), |
| 87 |
Range::get_attribute([ |
| 88 |
'attributeName' => 'gap', |
| 89 |
'isResponsive' => true, |
| 90 |
'attributeObjectKey' => 'value', |
| 91 |
'defaultValue' => 10, |
| 92 |
'hasUnit' => false, |
| 93 |
]), |
| 94 |
Range::get_attribute([ |
| 95 |
'attributeName' => 'toggleWidth', |
| 96 |
'isResponsive' => false, |
| 97 |
'defaultValue' => 60, |
| 98 |
]), |
| 99 |
Range::get_attribute([ |
| 100 |
'attributeName' => 'toggleHeight', |
| 101 |
'isResponsive' => false, |
| 102 |
'defaultValue' => 28, |
| 103 |
]), |
| 104 |
); |
| 105 |
|
| 106 |
return array_merge( $attributes, \ABlocks\Classes\BlockGlobal::get_attributes() ); |
| 107 |
|
| 108 |
|