| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* The smallest unit of an item, the field it self. |
| 5 |
*/ |
| 6 |
abstract class VP_Control_FieldMultiImage extends VP_Control_FieldMulti |
| 7 |
{ |
| 8 |
|
| 9 |
protected $_item_max_height; |
| 10 |
|
| 11 |
protected $_item_max_width; |
| 12 |
|
| 13 |
/** |
| 14 |
* Basic self setup of the object |
| 15 |
* @param SimpleXMLElement $simpleXML SimpleXML object representation of the field |
| 16 |
* @return VP_Control_FieldMultiImage Field object |
| 17 |
*/ |
| 18 |
protected function _basic_make($arr) |
| 19 |
{ |
| 20 |
parent::_basic_make($arr); |
| 21 |
|
| 22 |
$this->set_item_max_height(isset($arr['item_max_height']) ? $arr['item_max_height'] : '') |
| 23 |
->set_item_max_width(isset($arr['item_max_width']) ? $arr['item_max_width'] : ''); |
| 24 |
|
| 25 |
return $this; |
| 26 |
} |
| 27 |
|
| 28 |
protected function _setup_data() |
| 29 |
{ |
| 30 |
parent::_setup_data(); |
| 31 |
$this->add_data('item_max_height', $this->get_item_max_height()); |
| 32 |
$this->add_data('item_max_width', $this->get_item_max_width()); |
| 33 |
} |
| 34 |
|
| 35 |
public function add_items_from_array($_items){ |
| 36 |
foreach ($_items as $item) |
| 37 |
{ |
| 38 |
$the_item = new VP_Control_Field_Item_Generic(); |
| 39 |
$the_item->value($item['value']) |
| 40 |
->label($item['label']) |
| 41 |
->img($item['img']); |
| 42 |
$this->add_item($the_item); |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Get item max height |
| 48 |
* |
| 49 |
* @return Integer Item Max Height |
| 50 |
*/ |
| 51 |
public function get_item_max_height() { |
| 52 |
return $this->_item_max_height; |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Set item max height |
| 57 |
* |
| 58 |
* @param Integer $_item_max_height Item Max Height |
| 59 |
*/ |
| 60 |
public function set_item_max_height($_item_max_height) { |
| 61 |
$this->_item_max_height = $_item_max_height; |
| 62 |
return $this; |
| 63 |
} |
| 64 |
|
| 65 |
/** |
| 66 |
* Get item max width |
| 67 |
* |
| 68 |
* @return Integer Item Max Width |
| 69 |
*/ |
| 70 |
public function get_item_max_width() { |
| 71 |
return $this->_item_max_width; |
| 72 |
} |
| 73 |
|
| 74 |
/** |
| 75 |
* Set item max width |
| 76 |
* |
| 77 |
* @param Integer $_item_max_width Item Max Width |
| 78 |
*/ |
| 79 |
public function set_item_max_width($_item_max_width) { |
| 80 |
$this->_item_max_width = $_item_max_width; |
| 81 |
return $this; |
| 82 |
} |
| 83 |
|
| 84 |
} |
| 85 |
|
| 86 |
/** |
| 87 |
* EOF |
| 88 |
*/ |