Pimcore\Model\Element\Service::getCustomViewById PHP Method

getCustomViewById() public static method

public static getCustomViewById ( $id )
    public static function getCustomViewById($id)
    {
        $customViews = Tool::getCustomViewConfig();
        if ($customViews) {
            foreach ($customViews as $customView) {
                if ($customView["id"] == $id) {
                    return $customView;
                }
            }
        }
    }

Usage Example

Esempio n. 1
0
 public function treeGetChildsByIdAction()
 {
     $document = Document::getById($this->getParam("node"));
     $documents = [];
     $cv = false;
     if ($document->hasChilds()) {
         $limit = intval($this->getParam("limit"));
         if (!$this->getParam("limit")) {
             $limit = 100000000;
         }
         $offset = intval($this->getParam("start"));
         if ($this->getParam("view")) {
             $cv = \Pimcore\Model\Element\Service::getCustomViewById($this->getParam("view"));
         }
         $list = new Document\Listing();
         if ($this->getUser()->isAdmin()) {
             $list->setCondition("parentId = ? ", $document->getId());
         } else {
             $userIds = $this->getUser()->getRoles();
             $userIds[] = $this->getUser()->getId();
             $list->setCondition("parentId = ? and\n                                        (\n                                        (select list from users_workspaces_document where userId in (" . implode(',', $userIds) . ") and LOCATE(CONCAT(path,`key`),cpath)=1  ORDER BY LENGTH(cpath) DESC LIMIT 1)=1\n                                        or\n                                        (select list from users_workspaces_document where userId in (" . implode(',', $userIds) . ") and LOCATE(cpath,CONCAT(path,`key`))=1  ORDER BY LENGTH(cpath) DESC LIMIT 1)=1\n                                        )", $document->getId());
         }
         $list->setOrderKey(["index", "id"]);
         $list->setOrder(["asc", "asc"]);
         $list->setLimit($limit);
         $list->setOffset($offset);
         \Pimcore\Model\Element\Service::addTreeFilterJoins($cv, $list);
         $childsList = $list->load();
         foreach ($childsList as $childDocument) {
             // only display document if listing is allowed for the current user
             if ($childDocument->isAllowed("list")) {
                 $documents[] = $this->getTreeNodeConfig($childDocument);
             }
         }
     }
     if ($this->getParam("limit")) {
         $this->_helper->json(["offset" => $offset, "limit" => $limit, "total" => $document->getChildAmount($this->getUser()), "nodes" => $documents]);
     } else {
         $this->_helper->json($documents);
     }
     $this->_helper->json(false);
 }
All Usage Examples Of Pimcore\Model\Element\Service::getCustomViewById