当前位置: 首页>>代码示例>>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;未经允许,请勿转载。