Completed
Push — feature/codesniffer-fixes ( c7a4f1...41059d )
by Scott Kingsley
13:22
created

PodsComponent   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 94
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 94
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A init() 0 4 1
A handler() 0 3 1
1
<?php
2
3
/**
4
 * The base component class, all components should extend this.
5
 *
6
 * @package Pods
7
 */
8
class PodsComponent {
9
10
	/**
11
	 * Setup initial component class.
12
	 *
13
	 * @since 2.0
14
	 */
15
	public function __construct() {
16
17
		$this->init();
18
19
	}
20
21
	/**
22
	 * Do things like register/enqueue scripts and stylesheets.
23
	 *
24
	 * @since 2.7.2
25
	 */
26
	public function init() {
27
0 ignored issues
show
Coding Style introduced by
Functions must not contain multiple empty lines in a row; found 2 empty lines
Loading history...
28
29
	}
30
31
	/**
32
	 * Add options and set defaults for component settings, shows in admin area
33
	 *
34
	 * @return array $options
35
	 *
36
	 * @since 2.0
37
	 * public function options () {
38
	 * $options = array(
39
	 * 'option_name' => array(
40
	 * 'label' => 'Option Label',
41
	 * 'depends-on' => array( 'another_option' => 'specific-value' ),
42
	 * 'default' => 'default-value',
43
	 * 'type' => 'field_type',
44
	 * 'data' => array(
45
	 * 'value1' => 'Label 1',
46
	 *
47
	 * // Group your options together
48
	 * 'Option Group' => array(
49
	 * 'gvalue1' => 'Option Label 1',
50
	 * 'gvalue2' => 'Option Label 2'
51
	 * ),
52
	 *
53
	 * // below is only if the option_name above is the "{$fieldtype}_format_type"
54
	 * 'value2' => array(
55
	 * 'label' => 'Label 2',
56
	 * 'regex' => '[a-zA-Z]' // Uses JS regex validation for the value saved if this option selected
57
	 * )
58
	 * ),
59
	 *
60
	 * // below is only for a boolean group
61
	 * 'group' => array(
62
	 * 'option_boolean1' => array(
63
	 * 'label' => 'Option boolean 1?',
64
	 * 'default' => 1,
65
	 * 'type' => 'boolean'
66
	 * ),
67
	 * 'option_boolean2' => array(
68
	 * 'label' => 'Option boolean 2?',
69
	 * 'default' => 0,
70
	 * 'type' => 'boolean'
71
	 * )
72
	 * )
73
	 * )
74
	 * );
75
	 *
76
	 * return $options;
77
	 * }
78
	 */
79
80
	/**
81
	 * Handler to run code based on $options
82
	 *
83
	 * @param array $options Component options.
84
	 *
85
	 * @since 2.0
86
	 */
87
	public function handler( $options ) {
88
		// run code based on $options set
89
	}
90
91
	/**
92
	 * Build admin area
93
	 *
94
	 * @param array $options Component options.
95
	 *
96
	 * @since 2.0
97
	 * public function admin ( $options ) {
98
	 * // run code based on $options set
99
	 * }
100
	 */
101
}
102