| 1 |
<?php |
| 2 |
namespace ABlocks\Blocks\TableOfContent; |
| 3 |
|
| 4 |
use ABlocks\Controls\Typography; |
| 5 |
use ABlocks\Controls\Background; |
| 6 |
use ABlocks\Controls\Border; |
| 7 |
use ABlocks\Controls\Dimensions; |
| 8 |
use ABlocks\Controls\Alignment; |
| 9 |
use ABlocks\Controls\Range; |
| 10 |
use ABlocks\Controls\Icon; |
| 11 |
use ABlocks\Helper; |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
$attributes = [ |
| 18 |
'block_id' => array( |
| 19 |
'type' => 'string', |
| 20 |
'default' => '', |
| 21 |
), |
| 22 |
'tocTableTitle' => array( |
| 23 |
'type' => 'string', |
| 24 |
'default' => 'Table Of Contents', |
| 25 |
), |
| 26 |
'H1' => array( |
| 27 |
'type' => 'boolean', |
| 28 |
'default' => true, |
| 29 |
), |
| 30 |
'H2' => array( |
| 31 |
'type' => 'boolean', |
| 32 |
'default' => true, |
| 33 |
), |
| 34 |
'H3' => array( |
| 35 |
'type' => 'boolean', |
| 36 |
'default' => true, |
| 37 |
), |
| 38 |
'H4' => array( |
| 39 |
'type' => 'boolean', |
| 40 |
'default' => true, |
| 41 |
), |
| 42 |
'H5' => array( |
| 43 |
'type' => 'boolean', |
| 44 |
'default' => true, |
| 45 |
), |
| 46 |
'H6' => array( |
| 47 |
'type' => 'boolean', |
| 48 |
'default' => true, |
| 49 |
), |
| 50 |
'hideTitle' => array( |
| 51 |
'type' => 'boolean', |
| 52 |
'default' => true, |
| 53 |
), |
| 54 |
'collapSible' => array( |
| 55 |
'type' => 'boolean', |
| 56 |
'default' => true, |
| 57 |
), |
| 58 |
'markerView' => array( |
| 59 |
'type' => 'string', |
| 60 |
'default' => 'ul', |
| 61 |
), |
| 62 |
'titleColor' => array( |
| 63 |
'type' => 'string', |
| 64 |
'default' => '#000000', |
| 65 |
), |
| 66 |
'itemColor' => array( |
| 67 |
'type' => 'string', |
| 68 |
'default' => '#333', |
| 69 |
), |
| 70 |
'iconColor' => array( |
| 71 |
'type' => 'string', |
| 72 |
), |
| 73 |
'headerBG' => array( |
| 74 |
'type' => 'string', |
| 75 |
'default' => '#ddd', |
| 76 |
), |
| 77 |
'bodyBG' => array( |
| 78 |
'type' => 'string', |
| 79 |
'default' => '', |
| 80 |
), |
| 81 |
|
| 82 |
]; |
| 83 |
|
| 84 |
$attributes = array_merge( |
| 85 |
$attributes, |
| 86 |
Typography::get_attribute( 'titleTypography', true ), |
| 87 |
Typography::get_attribute( 'contentTypography', true ), |
| 88 |
Border::get_attribute( 'headerBorder', true ), |
| 89 |
Dimensions::get_attribute( 'header_padding', true ), |
| 90 |
Dimensions::get_attribute( 'list_padding', true ), |
| 91 |
Icon::get_attribute( 'openIcon', [ |
| 92 |
'path' => 'M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z', |
| 93 |
'viewBox' => '0 0 448 512', |
| 94 |
'className' => 'fas fa-chevron-down', |
| 95 |
] ), |
| 96 |
Icon::get_attribute( 'closeIcon', [ |
| 97 |
'path' => 'M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z', |
| 98 |
'viewBox' => '0 0 448 512', |
| 99 |
'className' => 'fas fa-chevron-up', |
| 100 |
] ), |
| 101 |
Range::get_attribute([ |
| 102 |
'attributeName' => 'iconSize', |
| 103 |
'isResponsive' => false, |
| 104 |
'defaultValue' => 20, |
| 105 |
]), |
| 106 |
Range::get_attribute( [ |
| 107 |
'attributeName' => 'listItemGap', |
| 108 |
'attributeObjectKey' => 'value', |
| 109 |
'isResponsive' => false, |
| 110 |
'defaultValue' => 30, |
| 111 |
'hasUnit' => true, |
| 112 |
'unitDefaultValue' => 'px', |
| 113 |
] ), |
| 114 |
); |
| 115 |
|
| 116 |
return array_merge( $attributes, \ABlocks\Classes\BlockGlobal::get_attributes() ); |
| 117 |
|
| 118 |
|