1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace GeminiLabs\SiteReviews\Widgets; |
4
|
|
|
|
5
|
|
|
use GeminiLabs\SiteReviews\Contracts\ShortcodeContract; |
6
|
|
|
use GeminiLabs\SiteReviews\Modules\Rating; |
7
|
|
|
use GeminiLabs\SiteReviews\Shortcodes\SiteReviewsSummaryShortcode; |
8
|
|
|
|
9
|
|
|
class SiteReviewsSummaryWidget extends Widget |
10
|
|
|
{ |
11
|
|
|
protected function widgetConfig(): array |
12
|
|
|
{ |
13
|
|
|
return [ |
14
|
|
|
'assigned_posts' => [ |
15
|
|
|
'description' => esc_html_x('Enter "post_id" to use the Post ID of the current page.', 'admin-text', 'site-reviews'), |
16
|
|
|
'label' => esc_html_x('Limit Reviews by Assigned Pages', 'admin-text', 'site-reviews'), |
17
|
|
|
'type' => 'text', |
18
|
|
|
], |
19
|
|
|
'assigned_terms' => [ |
20
|
|
|
'description' => esc_html_x('Enter the Term ID or slug of a category.', 'admin-text', 'site-reviews'), |
21
|
|
|
'label' => esc_html_x('Limit Reviews by Assigned Categories', 'admin-text', 'site-reviews'), |
22
|
|
|
'type' => 'text', |
23
|
|
|
], |
24
|
|
|
'assigned_users' => [ |
25
|
|
|
'description' => esc_html_x('Enter "user_id" to use the ID of the logged-in user.', 'admin-text', 'site-reviews'), |
26
|
|
|
'label' => esc_html_x('Limit Reviews by Assigned Users', 'admin-text', 'site-reviews'), |
27
|
|
|
'type' => 'text', |
28
|
|
|
], |
29
|
|
|
'terms' => [ |
30
|
|
|
'label' => esc_html_x('Limit Reviews by Accepted Terms', 'admin-text', 'site-reviews'), |
31
|
|
|
'options' => $this->shortcode->options('terms', [ |
32
|
|
|
'placeholder' => _x('— Select —', 'admin-text', 'site-reviews'), |
33
|
|
|
]), |
34
|
|
|
'type' => 'select', |
35
|
|
|
], |
36
|
|
|
'type' => [ |
37
|
|
|
'label' => esc_html_x('Limit Reviews by Type', 'admin-text', 'site-reviews'), |
38
|
|
|
'options' => $this->shortcode->options('type'), |
39
|
|
|
'type' => 'select', |
40
|
|
|
'value' => 'local', |
41
|
|
|
], |
42
|
|
|
'rating' => [ |
43
|
|
|
'label' => esc_html_x('Minimum Rating', 'admin-text', 'site-reviews'), |
44
|
|
|
'max' => Rating::max(), |
45
|
|
|
'min' => max(1, Rating::min()), |
46
|
|
|
'type' => 'number', |
47
|
|
|
'value' => max(1, Rating::min()), |
48
|
|
|
], |
49
|
|
|
'hide' => [ |
50
|
|
|
'options' => $this->shortcode->options('hide'), |
51
|
|
|
'type' => 'checkbox', |
52
|
|
|
], |
53
|
|
|
]; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
protected function widgetShortcode(): ShortcodeContract |
57
|
|
|
{ |
58
|
|
|
return glsr(SiteReviewsSummaryShortcode::class); |
|
|
|
|
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|