本文整理汇总了PHP中Pimcore\Model\Element\Service::gridElementData方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::gridElementData方法的具体用法?PHP Service::gridElementData怎么用?PHP Service::gridElementData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Model\Element\Service
的用法示例。
在下文中一共展示了Service::gridElementData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gridAssetData
/**
* @param Asset $asset
* @return void
*/
public static function gridAssetData($asset)
{
$data = Element\Service::gridElementData($asset);
return $data;
}
示例2: gridObjectData
/**
* @param AbstractObject $object
* @return array
*/
public static function gridObjectData($object, $fields = null)
{
$localizedPermissionsResolved = false;
$data = Element\Service::gridElementData($object);
if ($object instanceof Concrete) {
$data["classname"] = $object->getClassName();
$data["idPath"] = Element\Service::getIdPath($object);
$data['inheritedFields'] = array();
$user = AdminTool::getCurrentUser();
//TODO keep this for later!
// if (!$user->isAdmin()) {
// $permissionSet = $object->getPermissions(null, $user);
// $fieldPermissions = self::getFieldPermissions($object, $permissionSet);
// }
if (empty($fields)) {
$fields = array_keys($object->getclass()->getFieldDefinitions());
}
foreach ($fields as $key) {
$brickType = null;
$brickGetter = null;
$dataKey = $key;
$keyParts = explode("~", $key);
$def = $object->getClass()->getFieldDefinition($key);
if (substr($key, 0, 1) == "~") {
$type = $keyParts[1];
if ($type == "keyvalue") {
$field = $keyParts[2];
$keyid = $keyParts[3];
$getter = "get" . ucfirst($field);
if (method_exists($object, $getter)) {
$keyValuePairs = $object->{$getter}();
if ($keyValuePairs) {
// get with inheritance
$props = $keyValuePairs->getProperties();
foreach ($props as $pair) {
if ($pair["key"] == $keyid) {
if (isset($pair["translated"])) {
if (isset($data['#kv-tr'][$dataKey])) {
if (!is_array($data['#kv-tr'][$dataKey])) {
$arr = array($data['#kv-tr'][$dataKey]);
$data['#kv-tr'][$dataKey] = $arr;
}
$data['#kv-tr'][$dataKey][] = $pair["translated"];
} else {
$data['#kv-tr'][$dataKey] = $pair["translated"];
}
}
if (isset($data[$dataKey])) {
if (!is_array($data[$dataKey])) {
$arr = array($data[$dataKey]);
$data[$dataKey] = $arr;
}
$data[$dataKey][] = $pair["value"];
} else {
$data[$dataKey] = $pair["value"];
}
if ($pair["inherited"]) {
$data['inheritedFields'][$dataKey] = array("inherited" => $pair["inherited"], "objectid" => $pair["source"]);
}
// break;
}
}
}
}
}
} else {
if (count($keyParts) > 1) {
// brick
$brickType = $keyParts[0];
$brickKey = $keyParts[1];
$key = self::getFieldForBrickType($object->getclass(), $brickType);
$brickClass = Objectbrick\Definition::getByKey($brickType);
$def = $brickClass->getFieldDefinition($brickKey);
}
}
if (!empty($key)) {
// some of the not editable field require a special response
$getter = "get" . ucfirst($key);
$brickGetter = null;
if (!empty($brickKey)) {
$brickGetter = "get" . ucfirst($brickKey);
}
$needLocalizedPermissions = false;
// if the definition is not set try to get the definition from localized fields
if (!$def) {
if ($locFields = $object->getClass()->getFieldDefinition("localizedfields")) {
$def = $locFields->getFieldDefinition($key);
if ($def) {
$needLocalizedPermissions = true;
}
}
}
//relation type fields with remote owner do not have a getter
if (method_exists($object, $getter)) {
//system columns must not be inherited
if (in_array($key, Concrete::$systemColumnNames)) {
//.........这里部分代码省略.........
示例3: gridDocumentData
/**
* @param Document $document
* @return void
*/
public static function gridDocumentData($document)
{
$data = Element\Service::gridElementData($document);
if ($document instanceof Document\Page) {
$data["title"] = $document->getTitle();
$data["description"] = $document->getDescription();
$data["keywords"] = $document->getKeywords();
} else {
$data["title"] = "";
$data["description"] = "";
$data["keywords"] = "";
$data["name"] = "";
}
return $data;
}