本文整理匯總了PHP中WireData::_getDot方法的典型用法代碼示例。如果您正苦於以下問題:PHP WireData::_getDot方法的具體用法?PHP WireData::_getDot怎麽用?PHP WireData::_getDot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WireData
的用法示例。
在下文中一共展示了WireData::_getDot方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getItemPropertyValue
/**
* Get the value of $property from $item
*
* Used by the WireArray::sort method to retrieve a value from a Wire object.
* If output formatting is on, we turn it off to ensure that the sorting
* is performed without output formatting.
*
* @param Wire $item
* @param string $property
* @return mixed
*
*/
protected function getItemPropertyValue(Wire $item, $property)
{
if ($item instanceof Page) {
$value = $item->getUnformatted($property);
} else {
if (strpos($property, '.') !== false) {
$value = WireData::_getDot($property, $item);
} else {
if ($item instanceof WireArray) {
$value = $item->getProperty($property);
if (is_null($value)) {
$value = $item->first();
$value = $this->getItemPropertyValue($value, $property);
}
} else {
$value = $item->{$property};
}
}
}
if (is_array($value)) {
$value = implode('|', $value);
}
return $value;
}
示例2: getItemPropertyValue
/**
* Get the value of $property from $item
*
* Used by the WireArray::sort method to retrieve a value from a Wire object.
* Primarily here as a template method so that it can be overridden.
* Lets it prepare the Wire for any states needed for sorting.
*
* @param Wire $item
* @param string $property
* @return mixed
*
*/
protected function getItemPropertyValue(Wire $item, $property)
{
if (strpos($property, '.') !== false) {
return WireData::_getDot($property, $item);
}
return $item->{$property};
}