本文整理汇总了PHP中Pimcore\Model\Object\Service::getCustomGridFieldDefinitions方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::getCustomGridFieldDefinitions方法的具体用法?PHP Service::getCustomGridFieldDefinitions怎么用?PHP Service::getCustomGridFieldDefinitions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Model\Object\Service
的用法示例。
在下文中一共展示了Service::getCustomGridFieldDefinitions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gridGetColumnConfigAction
public function gridGetColumnConfigAction()
{
if ($this->getParam("id")) {
$class = Object\ClassDefinition::getById($this->getParam("id"));
} else {
if ($this->getParam("name")) {
$class = Object\ClassDefinition::getByName($this->getParam("name"));
}
}
$gridType = "search";
if ($this->getParam("gridtype")) {
$gridType = $this->getParam("gridtype");
}
$objectId = $this->getParam("objectId");
if ($objectId) {
$fields = Object\Service::getCustomGridFieldDefinitions($class->getId(), $objectId);
}
if (!$fields) {
$fields = $class->getFieldDefinitions();
}
$types = array();
if ($this->getParam("types")) {
$types = explode(",", $this->getParam("types"));
}
// grid config
$gridConfig = array();
if ($objectId) {
$configFiles["configFileClassUser"] = PIMCORE_CONFIGURATION_DIRECTORY . "/object/grid/" . $this->getParam("objectId") . "_" . $class->getId() . "-user_" . $this->getUser()->getId() . ".psf";
$configFiles["configFileUser"] = PIMCORE_CONFIGURATION_DIRECTORY . "/object/grid/" . $this->getParam("objectId") . "-user_" . $this->getUser()->getId() . ".psf";
foreach ($configFiles as $configFile) {
if (is_file($configFile)) {
$gridConfig = Tool\Serialize::unserialize(file_get_contents($configFile));
if (is_array($gridConfig) && array_key_exists("classId", $gridConfig)) {
if ($gridConfig["classId"] == $class->getId()) {
break;
} else {
$gridConfig = array();
}
} else {
break;
}
}
}
}
$localizedFields = array();
$objectbrickFields = array();
foreach ($fields as $key => $field) {
if ($field instanceof Object\ClassDefinition\Data\Localizedfields) {
$localizedFields[] = $field;
} else {
if ($field instanceof Object\ClassDefinition\Data\Objectbricks) {
$objectbrickFields[] = $field;
}
}
}
$availableFields = array();
$systemColumns = array("id", "fullpath", "published", "creationDate", "modificationDate", "filename", "classname");
if (empty($gridConfig)) {
$count = 0;
if (!$this->getParam("no_system_columns")) {
$vis = $class->getPropertyVisibility();
foreach ($systemColumns as $sc) {
$key = $sc;
if ($key == "fullpath") {
$key = "path";
}
if (empty($types) && ($vis[$gridType][$key] || $gridType == "all")) {
$availableFields[] = array("key" => $sc, "type" => "system", "label" => $sc, "position" => $count);
$count++;
}
}
}
$includeBricks = !$this->getParam("no_brick_columns");
foreach ($fields as $key => $field) {
if ($field instanceof Object\ClassDefinition\Data\Localizedfields) {
foreach ($field->getFieldDefinitions() as $fd) {
if (empty($types) || in_array($fd->getFieldType(), $types)) {
$fieldConfig = $this->getFieldGridConfig($fd, $gridType, $count);
if (!empty($fieldConfig)) {
$availableFields[] = $fieldConfig;
$count++;
}
}
}
} else {
if ($field instanceof Object\ClassDefinition\Data\Objectbricks && $includeBricks) {
if (in_array($field->getFieldType(), $types)) {
$fieldConfig = $this->getFieldGridConfig($field, $gridType, $count);
if (!empty($fieldConfig)) {
$availableFields[] = $fieldConfig;
$count++;
}
} else {
$allowedTypes = $field->getAllowedTypes();
if (!empty($allowedTypes)) {
foreach ($allowedTypes as $t) {
$brickClass = Object\Objectbrick\Definition::getByKey($t);
$brickFields = $brickClass->getFieldDefinitions();
if (!empty($brickFields)) {
foreach ($brickFields as $bf) {
//.........这里部分代码省略.........