本文整理汇总了PHP中SS_List::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP SS_List::exists方法的具体用法?PHP SS_List::exists怎么用?PHP SS_List::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SS_List
的用法示例。
在下文中一共展示了SS_List::exists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItems
/**
* @return SS_List
*/
public function getItems()
{
$name = $this->getName();
if (!$this->items || !$this->items->exists()) {
$record = $this->getRecord();
$this->items = array();
// Try to auto-detect relationship
if ($record && $record->exists()) {
if ($record->has_many($name) || $record->many_many($name)) {
// Ensure relationship is cast to an array, as we can't alter the items of a DataList/RelationList (see below)
$this->items = $record->{$name}()->toArray();
} elseif ($record->has_one($name)) {
$item = $record->{$name}();
if ($item && $item->exists()) {
$this->items = array($record->{$name}());
}
}
}
$this->items = new ArrayList($this->items);
// hack to provide $UploadFieldThumbnailURL, $hasRelation and $UploadFieldEditLink in template for each file
if ($this->items->exists()) {
foreach ($this->items as $i => $file) {
$this->items[$i] = $this->customiseFile($file);
if (!$file->canView()) {
unset($this->items[$i]);
}
// Respect model permissions
}
}
}
return $this->items;
}
示例2: exists
public function exists()
{
return $this->list->exists();
}