1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace GeminiLabs\SiteReviews\Widgets; |
4
|
|
|
|
5
|
|
|
use GeminiLabs\SiteReviews\Contracts\ShortcodeContract; |
6
|
|
|
use GeminiLabs\SiteReviews\Shortcodes\SiteReviewsSummaryShortcode; |
7
|
|
|
|
8
|
|
|
class SiteReviewsSummaryWidget extends Widget |
9
|
|
|
{ |
10
|
|
|
protected function shortcode(): ShortcodeContract |
11
|
|
|
{ |
12
|
|
|
return glsr(SiteReviewsSummaryShortcode::class); |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
protected function widgetConfig(): array |
16
|
|
|
{ |
17
|
|
|
return [ |
18
|
|
|
'assigned_posts' => [ |
19
|
|
|
'label' => esc_html_x('Limit Reviews by Assigned Pages', 'admin-text', 'site-reviews'), |
20
|
|
|
'description' => esc_html_x('Enter "post_id" to use the Post ID of the current page.', 'admin-text', 'site-reviews'), |
21
|
|
|
'type' => 'text', |
22
|
|
|
], |
23
|
|
|
'assigned_users' => [ |
24
|
|
|
'label' => esc_html_x('Limit Reviews by Assigned Users', 'admin-text', 'site-reviews'), |
25
|
|
|
'description' => esc_html_x('Enter "user_id" to use the ID of the logged-in user.', 'admin-text', 'site-reviews'), |
26
|
|
|
'type' => 'text', |
27
|
|
|
], |
28
|
|
|
'assigned_terms' => [ |
29
|
|
|
'label' => esc_html_x('Limit Reviews by Categories', 'admin-text', 'site-reviews'), |
30
|
|
|
'options' => $this->fieldAssignedTermsOptions(), |
31
|
|
|
'type' => 'select', |
32
|
|
|
], |
33
|
|
|
'terms' => [ |
34
|
|
|
'label' => esc_html_x('Limit Reviews by Accepted Terms', 'admin-text', 'site-reviews'), |
35
|
|
|
'options' => [ |
36
|
|
|
'' => esc_html_x('— Select —', 'admin-text', 'site-reviews'), |
37
|
|
|
'true' => esc_html_x('Terms were accepted', 'admin-text', 'site-reviews'), |
38
|
|
|
'false' => esc_html_x('Terms were not accepted', 'admin-text', 'site-reviews'), |
39
|
|
|
], |
40
|
|
|
'type' => 'select', |
41
|
|
|
], |
42
|
|
|
'type' => [ |
43
|
|
|
'label' => esc_html_x('Limit Reviews by Type', 'admin-text', 'site-reviews'), |
44
|
|
|
'options' => $this->fieldTypeOptions(), |
45
|
|
|
'type' => 'select', |
46
|
|
|
'value' => 'local', |
47
|
|
|
], |
48
|
|
|
'hide' => [ |
49
|
|
|
'options' => $this->shortcode()->getHideOptions(), |
50
|
|
|
'type' => 'checkbox', |
51
|
|
|
], |
52
|
|
|
'id' => [ |
53
|
|
|
'label' => esc_html_x('Custom ID', 'admin-text', 'site-reviews'), |
54
|
|
|
'description' => esc_html_x('This should be a unique value.', 'admin-text', 'site-reviews'), |
55
|
|
|
'type' => 'text', |
56
|
|
|
], |
57
|
|
|
'class' => [ |
58
|
|
|
'label' => esc_html_x('Additional CSS classes', 'admin-text', 'site-reviews'), |
59
|
|
|
'description' => esc_html_x('Separate multiple classes with spaces.', 'admin-text', 'site-reviews'), |
60
|
|
|
'type' => 'text', |
61
|
|
|
], |
62
|
|
|
]; |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|