-
Notifications
You must be signed in to change notification settings - Fork 41
/
Settings.php
86 lines (77 loc) · 2.05 KB
/
Settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
namespace TEC\Tickets\Site_Health\Fieldset;
use TEC\Tickets\Site_Health\Contracts\Fieldset_Abstract;
use Tribe__Utils__Array as Arr;
use TEC\Common\Site_Health\Factory;
use TEC\Common\Site_Health\Info_Field_Abstract;
/**
* Class Settings
*
* @since TBD
*
* @package TEC\Tickets\Site_Health\Fieldset
*/
class Settings extends Fieldset_Abstract {
/**
* @inheritdoc
*/
protected float $priority = 10.0;
/**
* @inheritdoc
*/
protected function get_fields(): array {
return [
[
'id' => 'ticket_enabled_post_types',
'label' => esc_html__( 'Ticket-enabled post types', 'event-tickets' ),
'value' => [ $this, 'get_post_types_enabled' ],
],
[
'id' => 'tickets_login_required_for_tickets',
'label' => esc_html__( 'Login required for Tickets', 'event-tickets' ),
'value' => [ $this, 'get_is_login_required_for_tickets' ],
],
[
'id' => 'tickets_login_required_for_rsvp',
'label' => esc_html__( 'Login required for RSVP', 'event-tickets' ),
'value' => [ $this, 'get_is_login_required_for_rsvp' ],
],
];
}
/**
* Get the post types enabled for tickets.
*
* @since TBD
*
* @return string
*/
public function get_post_types_enabled(): string {
$value = (array) tribe_get_option( 'ticket-enabled-post-types', [] );
$value = array_filter( $value );
return Arr::to_list( $value, ', ' );
}
/**
* Get if login is required for tickets.
*
* @since TBD
*
* @return string
*/
public function get_is_login_required_for_tickets(): string {
$value = (array) tribe_get_option( 'ticket-authentication-requirements', [] );
$value = array_filter( $value );
return in_array( 'event-tickets_all', $value, true ) ? static::YES : static::NO;
}
/**
* Get if login is required for RSVP.
*
* @since TBD
*
* @return string
*/
public function get_is_login_required_for_rsvp(): string {
$value = (array) tribe_get_option( 'ticket-authentication-requirements', [] );
$value = array_filter( $value );
return in_array( 'event-tickets_rsvp', $value, true ) ? static::YES : static::NO;
}
}