| 1 |
<?php |
| 2 |
|
| 3 |
abstract class VP_Option_Control_Group |
| 4 |
{ |
| 5 |
|
| 6 |
|
| 7 |
protected $_name; |
| 8 |
|
| 9 |
protected $_title; |
| 10 |
|
| 11 |
protected $_description; |
| 12 |
|
| 13 |
protected $_data; |
| 14 |
|
| 15 |
/** |
| 16 |
* Extra Classes for the container |
| 17 |
* @var Array |
| 18 |
*/ |
| 19 |
protected $_container_extra_classes; |
| 20 |
|
| 21 |
|
| 22 |
public function __construct() |
| 23 |
{ |
| 24 |
$this->_container_extra_classes = array(); |
| 25 |
} |
| 26 |
|
| 27 |
public abstract function render($extra = array()); |
| 28 |
|
| 29 |
protected function _setup_data(){} |
| 30 |
|
| 31 |
/** |
| 32 |
* Getter of $_name |
| 33 |
* |
| 34 |
* @return String Group unique name |
| 35 |
*/ |
| 36 |
public function get_name() { |
| 37 |
return $this->_name; |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* Setter of $_name |
| 42 |
* |
| 43 |
* @param String $_name Group unique name |
| 44 |
*/ |
| 45 |
public function set_name($_name) { |
| 46 |
$this->_name = $_name; |
| 47 |
return $this; |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Getter of title |
| 52 |
* |
| 53 |
* @return String Group title |
| 54 |
*/ |
| 55 |
public function get_title() { |
| 56 |
return $this->_title; |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* Setter of title |
| 61 |
* |
| 62 |
* @param String $_title Group title |
| 63 |
*/ |
| 64 |
public function set_title($_title) { |
| 65 |
$this->_title = $_title; |
| 66 |
return $this; |
| 67 |
} |
| 68 |
|
| 69 |
|
| 70 |
/** |
| 71 |
* Getter of $_description |
| 72 |
* |
| 73 |
* @return String Group description |
| 74 |
*/ |
| 75 |
public function get_description() { |
| 76 |
return $this->_description; |
| 77 |
} |
| 78 |
|
| 79 |
/** |
| 80 |
* Setter of $_description |
| 81 |
* |
| 82 |
* @param String $_description Group description |
| 83 |
*/ |
| 84 |
public function set_description($_description) { |
| 85 |
$this->_description = $_description; |
| 86 |
return $this; |
| 87 |
} |
| 88 |
|
| 89 |
/** |
| 90 |
* Add value to render data array |
| 91 |
* @param Mixed $item Value to be added to render data arary |
| 92 |
*/ |
| 93 |
public function add_data($key, $value) |
| 94 |
{ |
| 95 |
$this->_data[$key] = $value; |
| 96 |
} |
| 97 |
|
| 98 |
/** |
| 99 |
* Get render data |
| 100 |
* |
| 101 |
* @return Array Render data array |
| 102 |
*/ |
| 103 |
public function get_data() { |
| 104 |
return $this->_data; |
| 105 |
} |
| 106 |
|
| 107 |
/** |
| 108 |
* Set render data |
| 109 |
* |
| 110 |
* @param Array $_data Render data array |
| 111 |
*/ |
| 112 |
public function set_data($_data) { |
| 113 |
$this->_data = $_data; |
| 114 |
return $this; |
| 115 |
} |
| 116 |
|
| 117 |
/** |
| 118 |
* Getter of $_container_extra_classes |
| 119 |
* |
| 120 |
* @return Array of Extra Classes for the container |
| 121 |
*/ |
| 122 |
public function get_container_extra_classes() { |
| 123 |
return $this->_container_extra_classes; |
| 124 |
} |
| 125 |
|
| 126 |
/** |
| 127 |
* Setter of $_container_extra_classes |
| 128 |
* |
| 129 |
* @param Array $_container_extra_classes Extra Classes for the container |
| 130 |
*/ |
| 131 |
public function set_container_extra_classes($_container_extra_classes) { |
| 132 |
$this->_container_extra_classes = $_container_extra_classes; |
| 133 |
return $this; |
| 134 |
} |
| 135 |
|
| 136 |
public function add_container_extra_classes($class) |
| 137 |
{ |
| 138 |
if(is_array($class)) |
| 139 |
{ |
| 140 |
$this->_container_extra_classes = array_merge($this->_container_extra_classes, $class); |
| 141 |
} |
| 142 |
else if(!in_array($class, $this->_container_extra_classes)) |
| 143 |
{ |
| 144 |
$this->_container_extra_classes[] = $class; |
| 145 |
} |
| 146 |
return $this->_container_extra_classes; |
| 147 |
} |
| 148 |
|
| 149 |
} |