當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Service::getCustomGridFieldDefinitions方法代碼示例

本文整理匯總了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) {
//.........這裏部分代碼省略.........
開發者ID:cannonerd,項目名稱:pimcore,代碼行數:101,代碼來源:ObjectHelperController.php


注:本文中的Pimcore\Model\Object\Service::getCustomGridFieldDefinitions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。