protected function _basic_make($arr) { parent::_basic_make($arr); $default = $this->get_default(); $default = $this->validate_value($default); $this->set_default($default); }
/** * Basic self setup of the object * @param SimpleXMLElement $simpleXML SimpleXML object representation of the field * @return VP_Control_FieldMulti Field object */ protected function _basic_make($arr) { //add [] to name if control are assigned to multi if (isset($arr['multi']) && $arr['multi']) { $arr['name'] = $arr['name'] . '[]'; } parent::_basic_make($arr); if (!empty($arr['items'])) { if (isset($arr['items']['data']) and is_array($arr['items']['data'])) { foreach ($arr['items']['data'] as $data) { if ($data['source'] == 'function') { $function = $data['value']; $params = explode(',', !empty($data['params']) ? $data['params'] : ''); $items = call_user_func_array($function, $params); $arr['items'] = array_merge($arr['items'], $items); } else { if ($data['source'] == 'binding') { $function = $data['value']; $field = $data['field']; $this->set_items_binding($function . '|' . $field); } } } unset($arr['items']['data']); } if (is_array($arr['items'])) { foreach ($arr['items'] as $item) { $the_item = new VP_Control_Field_Item_Generic(); $the_item->value($item['value'])->label($item['label']); if (isset($item['img'])) { $the_item->img($item['img']); } $this->add_item($the_item); } } } if (isset($arr['default'])) { $arr['default'] = (array) $arr['default']; if (!VP_Util_Reflection::is_multiselectable($this)) { $arr['default'] = (array) reset($arr['default']); } $this->_raw_default = $arr['default']; $this->_process_default(); } return $this; }
protected function _basic_make($arr) { parent::_basic_make($arr); }
protected function _basic_make($arr) { parent::_basic_make($arr); $this->set_status(isset($arr['status']) ? $arr['status'] : 'normal'); }