Passed
Push — add/multiplan ( e46fc7...0a2963 )
by Warwick
04:26 queued 12s
created

Workout   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 109
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 62
c 1
b 0
f 0
dl 0
loc 109
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
B settings() 0 70 1
A get_instance() 0 6 2
A __construct() 0 2 1
1
<?php
2
/**
3
 * Contains the settings class for LSX
4
 *
5
 * @package lsx-health-plan
6
 */
7
8
namespace lsx_health_plan\classes\admin;
9
10
/**
11
 * Contains the settings for each post type \lsx_health_plan\classes\admin\Workout().
12
 */
13
class Workout {
14
15
	/**
16
	 * Holds class instance
17
	 *
18
	 * @since 1.0.0
19
	 *
20
	 * @var      object \lsx_health_plan\classes\admin\Workout()
21
	 */
22
	protected static $instance = null;
23
24
	/**
25
	 * Contructor
26
	 */
27
	public function __construct() {
28
		add_action( 'lsx_hp_settings_page_workout_top', array( $this, 'settings' ), 1, 1 );
29
	}
30
31
	/**
32
	 * Return an instance of this class.
33
	 *
34
	 * @since 1.0.0
35
	 *
36
	 * @return    object \lsx_health_plan\classes\admin\Workout()    A single instance of this class.
37
	 */
38
	public static function get_instance() {
39
		// If the single instance hasn't been set, set it now.
40
		if ( null === self::$instance ) {
41
			self::$instance = new self();
42
		}
43
		return self::$instance;
44
	}
45
46
	/**
47
	 * Registers the general settings.
48
	 *
49
	 * @param object $cmb new_cmb2_box().
50
	 * @return void
51
	 */
52
	public function settings( $cmb ) {
53
		$cmb->add_field(
54
			array(
55
				'id'          => 'workout_tab_layout',
56
				'type'        => 'select',
57
				'name'        => __( 'Workout Tab Layout', 'lsx-health-plan' ),
58
				'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ),
59
				'options'     => array(
60
					'table' => __( 'Table', 'lsx-health-plan' ),
61
					'list'  => __( 'List', 'lsx-health-plan' ),
62
					'grid'  => __( 'Grid', 'lsx-health-plan' ),
63
				),
64
			)
65
		);
66
		$cmb->add_field(
67
			array(
68
				'id'          => 'workout_tab_link',
69
				'type'        => 'select',
70
				'name'        => __( 'Workout Tab Link', 'lsx-health-plan' ),
71
				'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ),
72
				'options'     => array(
73
					''       => __( 'None', 'lsx-health-plan' ),
74
					'single' => __( 'Single', 'lsx-health-plan' ),
75
					'modal'  => __( 'Modal', 'lsx-health-plan' ),
76
				),
77
				'default' => 'modal',
78
			)
79
		);
80
		$cmb->add_field(
81
			array(
82
				'id'          => 'workout_tab_modal_content',
83
				'type'        => 'select',
84
				'name'        => __( 'Modal Content', 'lsx-health-plan' ),
85
				'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ),
86
				'options'     => array(
87
					''        => __( 'None', 'lsx-health-plan' ),
88
					'excerpt' => __( 'Excerpt', 'lsx-health-plan' ),
89
					'full'    => __( 'Full Content', 'lsx-health-plan' ),
90
				),
91
				'default' => '',
92
			)
93
		);
94
		$cmb->add_field(
95
			array(
96
				'id'          => 'workout_tab_columns',
97
				'type'        => 'select',
98
				'name'        => __( 'Grid Columns', 'lsx-health-plan' ),
99
				'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ),
100
				'options'     => array(
101
					'12' => __( '1', 'lsx-health-plan' ),
102
					'6'  => __( '2', 'lsx-health-plan' ),
103
					'4'  => __( '3', 'lsx-health-plan' ),
104
					'3'  => __( '4', 'lsx-health-plan' ),
105
					'2'  => __( '6', 'lsx-health-plan' ),
106
				),
107
				'default' => '4',
108
			)
109
		);
110
		$cmb->add_field(
111
			array(
112
				'id'          => 'workout_tab_content',
113
				'type'        => 'select',
114
				'name'        => __( 'Grid Content', 'lsx-health-plan' ),
115
				'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ),
116
				'options'     => array(
117
					''        => __( 'None', 'lsx-health-plan' ),
118
					'excerpt' => __( 'Excerpt', 'lsx-health-plan' ),
119
					'full'    => __( 'Full Content', 'lsx-health-plan' ),
120
				),
121
				'default' => '',
122
			)
123
		);
124
	}
125
}
126
Workout::get_instance();
127