本文整理匯總了PHP中Pimcore\Model\Object::doHideUnpublished方法的典型用法代碼示例。如果您正苦於以下問題:PHP Object::doHideUnpublished方法的具體用法?PHP Object::doHideUnpublished怎麽用?PHP Object::doHideUnpublished使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pimcore\Model\Object
的用法示例。
在下文中一共展示了Object::doHideUnpublished方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: preGetData
public function preGetData($object, $params = [])
{
$data = null;
if ($object instanceof Object\Concrete) {
$data = $object->{$this->getName()};
if ($this->getLazyLoading() and !in_array($this->getName(), $object->getO__loadedLazyFields())) {
//$data = $this->getDataFromResource($object->getRelationData($this->getName(), true, null));
$data = $this->load($object, ["force" => true]);
$setter = "set" . ucfirst($this->getName());
if (method_exists($object, $setter)) {
$object->{$setter}($data);
}
}
} elseif ($object instanceof Object\Localizedfield) {
$data = $params["data"];
} elseif ($object instanceof Object\Fieldcollection\Data\AbstractData) {
$data = $object->{$this->getName()};
} elseif ($object instanceof Object\Objectbrick\Data\AbstractData) {
$data = $object->{$this->getName()};
}
if (Object::doHideUnpublished() and is_array($data)) {
$publishedList = [];
foreach ($data as $listElement) {
if (Element\Service::isPublished($listElement)) {
$publishedList[] = $listElement;
}
}
return $publishedList;
}
return is_array($data) ? $data : [];
}