| @@ -1,0 +1,129 @@ | ||
| 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\Controls\BoxShadow; | |
| 12 | +use ABlocks\Helper; | |
| 13 | + | |
| 14 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 15 | + exit; | |
| 16 | +} | |
| 17 | + | |
| 18 | +$attributes = [ | |
| 19 | + 'block_id' => array( | |
| 20 | + 'type' => 'string', | |
| 21 | + 'default' => '', | |
| 22 | + ), | |
| 23 | + 'blockVersion' => array( | |
| 24 | + 'type' => 'number', | |
| 25 | + 'default' => '', | |
| 26 | + ), | |
| 27 | + 'tocTableTitle' => array( | |
| 28 | + 'type' => 'string', | |
| 29 | + 'default' => 'Table Of Contents', | |
| 30 | + ), | |
| 31 | + 'H1' => array( | |
| 32 | + 'type' => 'boolean', | |
| 33 | + 'default' => true, | |
| 34 | + ), | |
| 35 | + 'H2' => array( | |
| 36 | + 'type' => 'boolean', | |
| 37 | + 'default' => true, | |
| 38 | + ), | |
| 39 | + 'H3' => array( | |
| 40 | + 'type' => 'boolean', | |
| 41 | + 'default' => true, | |
| 42 | + ), | |
| 43 | + 'H4' => array( | |
| 44 | + 'type' => 'boolean', | |
| 45 | + 'default' => true, | |
| 46 | + ), | |
| 47 | + 'H5' => array( | |
| 48 | + 'type' => 'boolean', | |
| 49 | + 'default' => true, | |
| 50 | + ), | |
| 51 | + 'H6' => array( | |
| 52 | + 'type' => 'boolean', | |
| 53 | + 'default' => true, | |
| 54 | + ), | |
| 55 | + 'hideTitle' => array( | |
| 56 | + 'type' => 'boolean', | |
| 57 | + 'default' => true, | |
| 58 | + ), | |
| 59 | + 'collapSible' => array( | |
| 60 | + 'type' => 'boolean', | |
| 61 | + 'default' => true, | |
| 62 | + ), | |
| 63 | + 'markerView' => array( | |
| 64 | + 'type' => 'string', | |
| 65 | + 'default' => 'disc', | |
| 66 | + ), | |
| 67 | + 'titleColor' => array( | |
| 68 | + 'type' => 'string', | |
| 69 | + 'default' => '#000000', | |
| 70 | + ), | |
| 71 | + 'itemColor' => array( | |
| 72 | + 'type' => 'string', | |
| 73 | + 'default' => '#333', | |
| 74 | + ), | |
| 75 | + 'iconColor' => array( | |
| 76 | + 'type' => 'string', | |
| 77 | + ), | |
| 78 | + 'activeColor' => array( | |
| 79 | + 'type' => 'string', | |
| 80 | + 'default' => '#2763f3', | |
| 81 | + ), | |
| 82 | + 'headerBG' => array( | |
| 83 | + 'type' => 'string', | |
| 84 | + 'default' => '#ddd', | |
| 85 | + ), | |
| 86 | + 'bodyBG' => array( | |
| 87 | + 'type' => 'string', | |
| 88 | + 'default' => '', | |
| 89 | + ), | |
| 90 | + | |
| 91 | +]; | |
| 92 | + | |
| 93 | +$attributes = array_merge( | |
| 94 | + $attributes, | |
| 95 | + Typography::get_attribute( 'titleTypography', true ), | |
| 96 | + Typography::get_attribute( 'contentTypography', true ), | |
| 97 | + Border::get_attribute( 'headerBorder', true ), | |
| 98 | + Border::get_attribute( 'iconBorder', true ), | |
| 99 | + BoxShadow::get_attribute( 'iconBoxShadow', true ), | |
| 100 | + Dimensions::get_attribute( 'header_padding', true ), | |
| 101 | + Dimensions::get_attribute( 'icon_padding', true ), | |
| 102 | + Dimensions::get_attribute( 'list_padding', true ), | |
| 103 | + Icon::get_attribute( 'openIcon', [ | |
| 104 | + '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', | |
| 105 | + 'viewBox' => '0 0 448 512', | |
| 106 | + 'className' => 'fas fa-chevron-down', | |
| 107 | + ] ), | |
| 108 | + Icon::get_attribute( 'closeIcon', [ | |
| 109 | + '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', | |
| 110 | + 'viewBox' => '0 0 448 512', | |
| 111 | + 'className' => 'fas fa-chevron-up', | |
| 112 | + ] ), | |
| 113 | + Range::get_attribute([ | |
| 114 | + 'attributeName' => 'iconSize', | |
| 115 | + 'isResponsive' => false, | |
| 116 | + 'defaultValue' => 20, | |
| 117 | + ]), | |
| 118 | + Range::get_attribute( [ | |
| 119 | + 'attributeName' => 'listItemGap', | |
| 120 | + 'attributeObjectKey' => 'value', | |
| 121 | + 'isResponsive' => false, | |
| 122 | + 'defaultValue' => 30, | |
| 123 | + 'hasUnit' => true, | |
| 124 | + 'unitDefaultValue' => 'px', | |
| 125 | + ] ), | |
| 126 | +); | |
| 127 | + | |
| 128 | +return array_merge( $attributes, \ABlocks\Classes\BlockGlobal::get_attributes() ); | |
| 129 | + | |