| 1 |
<?php |
| 2 |
namespace ABlocks\Blocks\StarRatings; |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
use ABlocks\Controls\Alignment; |
| 9 |
use ABlocks\Controls\Range; |
| 10 |
use ABlocks\Controls\Typography; |
| 11 |
use ABlocks\Helper; |
| 12 |
use ABlocks\Controls\Icon; |
| 13 |
|
| 14 |
$attributes = [ |
| 15 |
'block_id' => [ |
| 16 |
'type' => 'string', |
| 17 |
'default' => '', |
| 18 |
], |
| 19 |
'blockVersion' => array( |
| 20 |
'type' => 'number', |
| 21 |
'default' => '', |
| 22 |
), |
| 23 |
'scale' => [ |
| 24 |
'type' => 'number', |
| 25 |
'default' => 5, |
| 26 |
], |
| 27 |
'ratingColor' => [ |
| 28 |
'type' => 'string', |
| 29 |
'default' => '#e99516', |
| 30 |
], |
| 31 |
'ratingUnmarkedColor' => [ |
| 32 |
'type' => 'string', |
| 33 |
'default' => '#696969' |
| 34 |
], |
| 35 |
'showCount' => [ |
| 36 |
'type' => 'boolean', |
| 37 |
'default' => true, |
| 38 |
], |
| 39 |
'showRatingNumber' => [ |
| 40 |
'type' => 'boolean', |
| 41 |
'default' => true, |
| 42 |
], |
| 43 |
'ratingNumberColor' => [ |
| 44 |
'type' => 'string', |
| 45 |
'default' => '#000000', |
| 46 |
], |
| 47 |
'ratingNumberPosition' => [ |
| 48 |
'type' => 'string', |
| 49 |
'default' => 'right', |
| 50 |
], |
| 51 |
'rating' => [ |
| 52 |
'type' => 'number', |
| 53 |
'default' => 4, |
| 54 |
], |
| 55 |
|
| 56 |
]; |
| 57 |
|
| 58 |
$attributes = array_merge( |
| 59 |
$attributes, |
| 60 |
Range::get_attribute( [ |
| 61 |
'attributeName' => 'size', |
| 62 |
'attributeObjectKey' => 'value', |
| 63 |
'isResponsive' => true, |
| 64 |
'defaultValue' => 24, |
| 65 |
'hasUnit' => true, |
| 66 |
'unitDefaultValue' => 'px', |
| 67 |
]), |
| 68 |
Range::get_attribute( [ |
| 69 |
'attributeName' => 'spacing', |
| 70 |
'attributeObjectKey' => 'value', |
| 71 |
'isResponsive' => true, |
| 72 |
'defaultValue' => 0, |
| 73 |
'hasUnit' => true, |
| 74 |
'unitDefaultValue' => 'px', |
| 75 |
] ), |
| 76 |
Range::get_attribute( [ |
| 77 |
'attributeName' => 'ratingNumberGap', |
| 78 |
'attributeObjectKey' => 'value', |
| 79 |
'isResponsive' => true, |
| 80 |
'defaultValue' => 0, |
| 81 |
'hasUnit' => true, |
| 82 |
'unitDefaultValue' => 'px', |
| 83 |
] ), |
| 84 |
Typography::get_attribute( 'ratingNumberTypography', true ), |
| 85 |
Alignment::get_attribute( 'alignment', true, [ 'value' => 'left' ] ), |
| 86 |
Icon::get_attribute('icon', [ |
| 87 |
'path' => 'M528.1 171.5L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6zM388.6 312.3l23.7 138.4L288 385.4l-124.3 65.3 23.7-138.4-100.6-98 139-20.2 62.2-126 62.2 126 139 20.2-100.6 98z', |
| 88 |
'viewBox' => '0 0 576 512', |
| 89 |
'className' => 'far fa-star', |
| 90 |
] ), |
| 91 |
); |
| 92 |
|
| 93 |
return array_merge( $attributes, \ABlocks\Classes\BlockGlobal::get_attributes() ); |
| 94 |
|
| 95 |
|