本文整理匯總了PHP中Element::data方法的典型用法代碼示例。如果您正苦於以下問題:PHP Element::data方法的具體用法?PHP Element::data怎麽用?PHP Element::data使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Element
的用法示例。
在下文中一共展示了Element::data方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fromCSV
/**
* 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;
}
示例2: getValue
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;
}
示例3: getValue
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;
}
示例4: data
/**
* Get element data in JSONData Object
* @return JSONData
*/
public function data()
{
return new AppData(parent::data());
}