| 1 |
<?php |
| 2 |
|
| 3 |
class VP_Option_Control_Group_Menu extends VP_Option_Control_Group |
| 4 |
{ |
| 5 |
|
| 6 |
/** |
| 7 |
* Collection of $_menu |
| 8 |
* @var VP_Option_Control_Group |
| 9 |
*/ |
| 10 |
private $_menus; |
| 11 |
|
| 12 |
/** |
| 13 |
* Collection of controls |
| 14 |
* @var VP_Control_Field |
| 15 |
*/ |
| 16 |
private $_controls; |
| 17 |
|
| 18 |
private $_icon; |
| 19 |
|
| 20 |
public function __construct() |
| 21 |
{ |
| 22 |
parent::__construct(); |
| 23 |
$this->_menus = array(); |
| 24 |
$this->_controls = array(); |
| 25 |
} |
| 26 |
|
| 27 |
public function render($extra = array()) |
| 28 |
{ |
| 29 |
// Setup data |
| 30 |
$this->_setup_data(); |
| 31 |
$this->add_data('menu', $this); |
| 32 |
foreach ($extra as $key => $value) |
| 33 |
{ |
| 34 |
$this->add_data($key, $value); |
| 35 |
} |
| 36 |
return VP_View::instance()->load('option/menu', $this->get_data()); |
| 37 |
} |
| 38 |
|
| 39 |
public function add_menu($menu) |
| 40 |
{ |
| 41 |
$this->_menus[] = $menu; |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Getter of $_menus |
| 46 |
* |
| 47 |
* @return Array Collection of menus object |
| 48 |
*/ |
| 49 |
public function get_menus() { |
| 50 |
return $this->_menus; |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* Setter of $_menus |
| 55 |
* |
| 56 |
* @param Array $_menus Collection of menus object |
| 57 |
*/ |
| 58 |
public function set_menus($_menus) |
| 59 |
{ |
| 60 |
$this->_menus = $_menus; |
| 61 |
return $this; |
| 62 |
} |
| 63 |
|
| 64 |
public function add_control($control) |
| 65 |
{ |
| 66 |
$this->_controls[] = $control; |
| 67 |
} |
| 68 |
|
| 69 |
/** |
| 70 |
* Getter of controls |
| 71 |
* |
| 72 |
* @return Array Collection of controls object |
| 73 |
*/ |
| 74 |
public function get_controls() |
| 75 |
{ |
| 76 |
return $this->_controls; |
| 77 |
} |
| 78 |
|
| 79 |
/** |
| 80 |
* Setter of controls |
| 81 |
* |
| 82 |
* @param Array $_controls Collection of controls object |
| 83 |
*/ |
| 84 |
public function set_controls($_controls) |
| 85 |
{ |
| 86 |
$this->_controls = $_controls; |
| 87 |
return $this; |
| 88 |
} |
| 89 |
|
| 90 |
/** |
| 91 |
* Get menu icon |
| 92 |
* |
| 93 |
* @return String Icon URL |
| 94 |
*/ |
| 95 |
public function get_icon() { |
| 96 |
return $this->_icon; |
| 97 |
} |
| 98 |
|
| 99 |
/** |
| 100 |
* Set menu icon |
| 101 |
* |
| 102 |
* @param String $_icon Icon URL |
| 103 |
*/ |
| 104 |
public function set_icon($_icon) { |
| 105 |
$this->_icon = $_icon; |
| 106 |
return $this; |
| 107 |
} |
| 108 |
|
| 109 |
} |