/** * Import data from CSV cell * @param $value * @param null $position * @return Item */ public function fromCSV($value, $position = null) { $value = $this->_getAutoClean($value); if ($this->_element) { if ($this->_isRepeatable) { // for repeatable objects if (strpos($value, JBCSVItem::SEP_ROWS)) { $tmpData = $this->_getArray($value, JBCSVItem::SEP_ROWS); foreach ($tmpData as $val) { if ($val === '') { return $this->_item; } $data[] = array('value' => $val); } $this->_element->bindData($data); } else { if ($value === '') { return $this->_item; } $data = $position == 1 ? array() : ($data = $this->_element->data()); $data[] = array('value' => JString::trim($value)); $this->_element->bindData($data); } } else { if ($value === '') { return $this->_item; } // for no repeatable objects $this->_element->bindData(array('value' => $value)); } } return $this->_item; }
public function getValue(Element $element) { $result = null; $data = $element->data(); foreach ($data['option'] as $data_value) { foreach ($element->config->option as $object) { if ($object['value'] == $data_value) { $result = $object; break 2; } } } return $result; }
public function getValue(Element $element) { $result = false; $data = $element->data(); if (is_array($data) && isset($data['option'])) { foreach ($data['option'] as $data_value) { foreach ($element->config->option as $object) { if ($object['value'] == $data_value) { $result = $object['name']; break 2; } } } } return $result; }
/** * Get element data in JSONData Object * @return JSONData */ public function data() { return new AppData(parent::data()); }