| 1 |
<?php |
| 2 |
namespace ABlocks\Blocks\FormBuilder; |
| 3 |
|
| 4 |
use ABlocks\Controls\Icon; |
| 5 |
use ABlocks\Controls\Border; |
| 6 |
use ABlocks\Controls\Range; |
| 7 |
use ABlocks\Components\ButtonGroup; |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
$attributes = [ |
| 14 |
'block_id' => array( |
| 15 |
'type' => 'string', |
| 16 |
'default' => '' |
| 17 |
), |
| 18 |
// 'inputWidth' => [ |
| 19 |
// 'type' => 'number', |
| 20 |
// 'default' => 100 |
| 21 |
// ], |
| 22 |
'customName' => [ |
| 23 |
'type' => 'string', |
| 24 |
'default' => '', |
| 25 |
], |
| 26 |
'label' => [ |
| 27 |
'type' => 'string', |
| 28 |
'default' => 'Name' |
| 29 |
], |
| 30 |
'helperText' => [ |
| 31 |
'type' => 'string', |
| 32 |
'default' => '' |
| 33 |
], |
| 34 |
'formType' => [ |
| 35 |
'type' => 'string', |
| 36 |
'default' => '' |
| 37 |
], |
| 38 |
'errorMsg' => [ |
| 39 |
'type' => 'string', |
| 40 |
'default' => 'This field is required', |
| 41 |
], |
| 42 |
'name' => [ |
| 43 |
'type' => 'string', |
| 44 |
'default' => '' |
| 45 |
], |
| 46 |
'placeholder' => [ |
| 47 |
'type' => 'string', |
| 48 |
'default' => 'name' |
| 49 |
], |
| 50 |
'inputType' => [ |
| 51 |
'type' => 'string', |
| 52 |
'default' => '' |
| 53 |
], |
| 54 |
'isRequired' => [ |
| 55 |
'type' => 'boolean', |
| 56 |
'default' => true |
| 57 |
], |
| 58 |
'nameChangeable' => [ |
| 59 |
'type' => 'boolean', |
| 60 |
'default' => true |
| 61 |
], |
| 62 |
'showIcon' => [ |
| 63 |
'type' => 'boolean', |
| 64 |
'default' => false |
| 65 |
], |
| 66 |
'iconColor' => [ |
| 67 |
'type' => 'string', |
| 68 |
'default' => '' |
| 69 |
], |
| 70 |
]; |
| 71 |
|
| 72 |
$attributes = array_merge( |
| 73 |
$attributes, |
| 74 |
Border::get_attribute( 'border', true ), |
| 75 |
Icon::get_attribute('icon', [ |
| 76 |
'size' => 28, |
| 77 |
] ), |
| 78 |
ButtonGroup::get_attribute( 'emailType', false, [ |
| 79 |
'value' => 'email', |
| 80 |
] ), |
| 81 |
Range::get_attribute( [ |
| 82 |
'attributeName' => 'inputIconSize', |
| 83 |
'isResponsive' => false, |
| 84 |
'defaultValue' => 28, |
| 85 |
] ), |
| 86 |
Range::get_attribute( [ |
| 87 |
'attributeName' => 'inputIconSpace', |
| 88 |
'isResponsive' => false, |
| 89 |
'defaultValue' => 38, |
| 90 |
] ), |
| 91 |
Range::get_attribute( [ |
| 92 |
'attributeName' => 'inputWidth', |
| 93 |
'attributeObjectKey' => 'value', |
| 94 |
'isResponsive' => true, |
| 95 |
'defaultValue' => 100, |
| 96 |
'hasUnit' => true, |
| 97 |
'unitDefaultValue' => '%', |
| 98 |
] ), |
| 99 |
); |
| 100 |
|
| 101 |
return array_merge( $attributes, \ABlocks\Classes\BlockGlobal::get_attributes() ); |
| 102 |
|
| 103 |
|