本文整理汇总了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};
}