| 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 |
|
| 19 |
'label' => [ |
| 20 |
'type' => 'string', |
| 21 |
'default' => '' |
| 22 |
], |
| 23 |
'name' => [ |
| 24 |
'type' => 'string', |
| 25 |
'default' => '' |
| 26 |
], |
| 27 |
'placeholder' => [ |
| 28 |
'type' => 'string', |
| 29 |
'default' => '*******' |
| 30 |
], |
| 31 |
'formType' => [ |
| 32 |
'type' => 'string', |
| 33 |
'default' => '' |
| 34 |
], |
| 35 |
'inputType' => [ |
| 36 |
'type' => 'string', |
| 37 |
'default' => '' |
| 38 |
], |
| 39 |
'isRequired' => [ |
| 40 |
'type' => 'boolean', |
| 41 |
'default' => true |
| 42 |
], |
| 43 |
'nameChangeable' => [ |
| 44 |
'type' => 'boolean', |
| 45 |
'default' => true, |
| 46 |
], |
| 47 |
'isPasswordVisible' => [ |
| 48 |
'type' => 'boolean', |
| 49 |
'default' => false |
| 50 |
], |
| 51 |
'showIcon' => [ |
| 52 |
'type' => 'boolean', |
| 53 |
'default' => false |
| 54 |
], |
| 55 |
'passwordShowHideToggle' => [ |
| 56 |
'type' => 'boolean', |
| 57 |
'default' => false |
| 58 |
], |
| 59 |
'passwordIconColor' => [ |
| 60 |
'type' => 'string', |
| 61 |
'default' => '' |
| 62 |
], |
| 63 |
'errorMsg' => [ |
| 64 |
'type' => 'string', |
| 65 |
'default' => 'This field is required' |
| 66 |
], |
| 67 |
'helperText' => [ |
| 68 |
'type' => 'string', |
| 69 |
'default' => '' |
| 70 |
], |
| 71 |
'iconColor' => [ |
| 72 |
'type' => 'string', |
| 73 |
'default' => '' |
| 74 |
], |
| 75 |
]; |
| 76 |
|
| 77 |
$attributes = array_merge( |
| 78 |
$attributes, |
| 79 |
Border::get_attribute( 'border', true ), |
| 80 |
Icon::get_attribute('icon', [ |
| 81 |
'size' => 28, |
| 82 |
'hasNoSelectorOrSource' => true, |
| 83 |
]), |
| 84 |
Icon::get_attribute( 'passwordShow', [ |
| 85 |
'path' => 'M634 471L36 3.51A16 16 0 0 0 13.51 6l-10 12.49A16 16 0 0 0 6 41l598 467.49a16 16 0 0 0 22.49-2.49l10-12.49A16 16 0 0 0 634 471zM296.79 146.47l134.79 105.38C429.36 191.91 380.48 144 320 144a112.26 112.26 0 0 0-23.21 2.47zm46.42 219.07L208.42 260.16C210.65 320.09 259.53 368 320 368a113 113 0 0 0 23.21-2.46zM320 112c98.65 0 189.09 55 237.93 144a285.53 285.53 0 0 1-44 60.2l37.74 29.5a333.7 333.7 0 0 0 52.9-75.11 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64c-36.7 0-71.71 7-104.63 18.81l46.41 36.29c18.94-4.3 38.34-7.1 58.22-7.1zm0 288c-98.65 0-189.08-55-237.93-144a285.47 285.47 0 0 1 44.05-60.19l-37.74-29.5a333.6 333.6 0 0 0-52.89 75.1 32.35 32.35 0 0 0 0 29.19C89.72 376.41 197.08 448 320 448c36.7 0 71.71-7.05 104.63-18.81l-46.41-36.28C359.28 397.2 339.89 400 320 400z', |
| 86 |
'viewBox' => '0 0 640 512', |
| 87 |
'className' => 'far fa-eye-slash', |
| 88 |
'hasNoSelectorOrSource' => true, |
| 89 |
] ), |
| 90 |
Icon::get_attribute( 'passwordHide', [ |
| 91 |
'path' => 'M288 144a110.94 110.94 0 0 0-31.24 5 55.4 55.4 0 0 1 7.24 27 56 56 0 0 1-56 56 55.4 55.4 0 0 1-27-7.24A111.71 111.71 0 1 0 288 144zm284.52 97.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400c-98.65 0-189.09-55-237.93-144C98.91 167 189.34 112 288 112s189.09 55 237.93 144C477.1 345 386.66 400 288 400z', |
| 92 |
'viewBox' => '0 0 576 512', |
| 93 |
'className' => 'far fa-eye', |
| 94 |
'hasNoSelectorOrSource' => true, |
| 95 |
] ), |
| 96 |
ButtonGroup::get_attribute( 'passwordType', false, [ |
| 97 |
'value' => 'password', |
| 98 |
] ), |
| 99 |
Range::get_attribute( [ |
| 100 |
'attributeName' => 'passwordShowHideIconSize', |
| 101 |
'isResponsive' => false, |
| 102 |
'defaultValue' => 18, |
| 103 |
] ), |
| 104 |
Range::get_attribute( [ |
| 105 |
'attributeName' => 'inputIconSize', |
| 106 |
'isResponsive' => false, |
| 107 |
'defaultValue' => 28, |
| 108 |
] ), |
| 109 |
Range::get_attribute( [ |
| 110 |
'attributeName' => 'inputIconSpace', |
| 111 |
'isResponsive' => false, |
| 112 |
'defaultValue' => 38, |
| 113 |
] ), |
| 114 |
Range::get_attribute( [ |
| 115 |
'attributeName' => 'inputWidth', |
| 116 |
'attributeObjectKey' => 'value', |
| 117 |
'isResponsive' => true, |
| 118 |
'defaultValue' => 100, |
| 119 |
'hasUnit' => true, |
| 120 |
'unitDefaultValue' => '%', |
| 121 |
] ), |
| 122 |
); |
| 123 |
|
| 124 |
return array_merge( $attributes, \ABlocks\Classes\BlockGlobal::get_attributes() ); |
| 125 |
|
| 126 |
|