当前位置: 首页>>代码示例>>PHP>>正文


PHP ClassDefinition::setLayoutDefinitions方法代码示例

本文整理汇总了PHP中Pimcore\Model\Object\ClassDefinition::setLayoutDefinitions方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassDefinition::setLayoutDefinitions方法的具体用法?PHP ClassDefinition::setLayoutDefinitions怎么用?PHP ClassDefinition::setLayoutDefinitions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pimcore\Model\Object\ClassDefinition的用法示例。


在下文中一共展示了ClassDefinition::setLayoutDefinitions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getById

 /**
  * @param null $id
  * @throws \Exception
  */
 public function getById($id = null)
 {
     if (!$id) {
         $id = $this->model->getId();
     }
     $classRaw = $this->db->fetchRow("SELECT * FROM classes WHERE id = ?", $id);
     if ($classRaw["id"]) {
         $this->assignVariablesToModel($classRaw);
         $this->model->setPropertyVisibility(Serialize::unserialize($classRaw["propertyVisibility"]));
         $this->model->setLayoutDefinitions($this->getLayoutData());
     } else {
         throw new \Exception("Class with ID " . $id . " doesn't exist");
     }
 }
开发者ID:solverat,项目名称:pimcore,代码行数:18,代码来源:Dao.php

示例2: getCustomGridFieldDefinitions

 public static function getCustomGridFieldDefinitions($classId, $objectId)
 {
     $object = AbstractObject::getById($objectId);
     $class = ClassDefinition::getById($classId);
     $masterFieldDefinition = $class->getFieldDefinitions();
     if (!$object) {
         return null;
     }
     $user = AdminTool::getCurrentUser();
     if ($user->isAdmin()) {
         return null;
     }
     $permissionList = array();
     $parentPermissionSet = $object->getPermissions(null, $user, true);
     if ($parentPermissionSet) {
         $permissionList[] = $parentPermissionSet;
     }
     $childPermissions = $object->getChildPermissions(null, $user);
     $permissionList = array_merge($permissionList, $childPermissions);
     $layoutDefinitions = array();
     foreach ($permissionList as $permissionSet) {
         $allowedLayoutIds = self::getLayoutPermissions($classId, $permissionSet);
         if (is_array($allowedLayoutIds)) {
             foreach ($allowedLayoutIds as $allowedLayoutId) {
                 if ($allowedLayoutId) {
                     if (!$layoutDefinitions[$allowedLayoutId]) {
                         $customLayout = ClassDefinition\CustomLayout::getById($allowedLayoutId);
                         if (!$customLayout) {
                             continue;
                         }
                         $layoutDefinitions[$allowedLayoutId] = $customLayout;
                     }
                 }
             }
         }
     }
     $mergedFieldDefinition = unserialize(serialize($masterFieldDefinition));
     if (count($layoutDefinitions)) {
         foreach ($mergedFieldDefinition as $key => $def) {
             if ($def instanceof ClassDefinition\Data\Localizedfields) {
                 $mergedLocalizedFieldDefinitions = $mergedFieldDefinition[$key]->getFieldDefinitions();
                 foreach ($mergedLocalizedFieldDefinitions as $locKey => $locValue) {
                     $mergedLocalizedFieldDefinitions[$locKey]->setInvisible(false);
                     $mergedLocalizedFieldDefinitions[$locKey]->setNotEditable(false);
                 }
                 $mergedFieldDefinition[$key]->setChilds($mergedLocalizedFieldDefinitions);
             } else {
                 $mergedFieldDefinition[$key]->setInvisible(false);
                 $mergedFieldDefinition[$key]->setNotEditable(false);
             }
         }
     }
     foreach ($layoutDefinitions as $customLayoutDefinition) {
         $layoutName = $customLayoutDefinition->getName();
         $layoutDefinitions = $customLayoutDefinition->getLayoutDefinitions();
         $dummyClass = new ClassDefinition();
         $dummyClass->setLayoutDefinitions($layoutDefinitions);
         $customFieldDefinitions = $dummyClass->getFieldDefinitions();
         foreach ($mergedFieldDefinition as $key => $value) {
             if (!$customFieldDefinitions[$key]) {
                 unset($mergedFieldDefinition[$key]);
             }
         }
         foreach ($customFieldDefinitions as $key => $def) {
             if ($def instanceof ClassDefinition\Data\Localizedfields) {
                 if (!$mergedFieldDefinition[$key]) {
                     continue;
                 }
                 $customLocalizedFieldDefinitions = $def->getFieldDefinitions();
                 $mergedLocalizedFieldDefinitions = $mergedFieldDefinition[$key]->getFieldDefinitions();
                 foreach ($mergedLocalizedFieldDefinitions as $locKey => $locValue) {
                     self::mergeFieldDefinition($mergedLocalizedFieldDefinitions, $customLocalizedFieldDefinitions, $locKey);
                 }
                 $mergedFieldDefinition[$key]->setChilds($mergedLocalizedFieldDefinitions);
             } else {
                 self::mergeFieldDefinition($mergedFieldDefinition, $customFieldDefinitions, $key);
             }
         }
     }
     return $mergedFieldDefinition;
 }
开发者ID:elavarasann,项目名称:pimcore,代码行数:81,代码来源:Service.php


注:本文中的Pimcore\Model\Object\ClassDefinition::setLayoutDefinitions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。