| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
use ABlocks\Controls\Link; |
| 8 |
use ABlocks\Controls\Icon; |
| 9 |
use ABlocks\Controls\Range; |
| 10 |
$attributes = [ |
| 11 |
'block_id' => [ |
| 12 |
'type' => 'string', |
| 13 |
'default' => '', |
| 14 |
], |
| 15 |
'label' => [ |
| 16 |
'type' => 'string', |
| 17 |
'default' => 'Menu', |
| 18 |
], |
| 19 |
'isSubMenu' => [ |
| 20 |
'type' => 'boolean', |
| 21 |
'default' => false, |
| 22 |
], |
| 23 |
'hasMegaMenu' => [ |
| 24 |
'type' => 'boolean', |
| 25 |
'default' => false |
| 26 |
], |
| 27 |
'hasLink' => [ |
| 28 |
'type' => 'boolean', |
| 29 |
'default' => false, |
| 30 |
], |
| 31 |
'link' => [ |
| 32 |
'type' => 'string', |
| 33 |
'default' => '#', |
| 34 |
], |
| 35 |
'showIcon' => [ |
| 36 |
'type' => 'boolean', |
| 37 |
'default' => false, |
| 38 |
], |
| 39 |
'iconPosition' => [ |
| 40 |
'type' => 'string', |
| 41 |
'default' => 'left', |
| 42 |
], |
| 43 |
]; |
| 44 |
|
| 45 |
$attributes = array_merge( |
| 46 |
$attributes, |
| 47 |
// Adding attributes from various controls |
| 48 |
Link::get_attribute( 'link' ), |
| 49 |
// The icon is stored in the block comment: the item's dropdown arrow also |
| 50 |
// uses `svg.ablocks-svg-icon`, so an HTML-sourced icon would read it back. |
| 51 |
Icon::get_attribute( 'icon', [ |
| 52 |
'size' => 16, |
| 53 |
'color' => '', |
| 54 |
'hasNoSelectorOrSource' => true, |
| 55 |
] ), |
| 56 |
Range::get_attribute([ |
| 57 |
'attributeName' => 'iconSpace', |
| 58 |
'attributeObjectKey' => 'value', |
| 59 |
'isResponsive' => true, |
| 60 |
'defaultValue' => 8, |
| 61 |
'hasUnit' => true, |
| 62 |
'unitDefaultValue' => 'px', |
| 63 |
]), |
| 64 |
); |
| 65 |
|
| 66 |
return $attributes; |
| 67 |
|