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


PHP Config::getObjectTypePluginsConfig方法代碼示例

本文整理匯總了PHP中CB\Config::getObjectTypePluginsConfig方法的典型用法代碼示例。如果您正苦於以下問題:PHP Config::getObjectTypePluginsConfig方法的具體用法?PHP Config::getObjectTypePluginsConfig怎麽用?PHP Config::getObjectTypePluginsConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CB\Config的用法示例。


在下文中一共展示了Config::getObjectTypePluginsConfig方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getPluginsData

 /**
  * get data for defined plugins to be displayed in properties panel for selected object
  * @param  array $p remote properties containing object id
  * @return ext   direct responce
  */
 public function getPluginsData($p)
 {
     $id = @$p['id'];
     $templateId = @$p['template_id'];
     $template = null;
     $templateData = null;
     $objectPlugins = null;
     $rez = array('success' => false, 'data' => array());
     if (empty($id) && empty($templateId) || !is_numeric($id) && !is_numeric($templateId)) {
         return $rez;
     }
     if (is_numeric($id)) {
         if (!$this->idExists($id)) {
             return $rez;
         }
         if (!Security::canRead($id)) {
             throw new \Exception(L\get('Access_denied'));
         }
         $rez['menu'] = Browser\CreateMenu::getMenuForPath($id);
         /* now we'll try to detect plugins config that could be found in following places:
                1. in config of the template for the given object, named object_plugins
                2. in core config, property object_type_plugins (config definitions per available template type values: object, case, task etc)
                3. a generic config,  named default_object_plugins, could be defined in core config
            */
         $o = $this->getCachedObject($id);
         if (!empty($o)) {
             $template = $o->getTemplate();
             if (!empty($template)) {
                 $templateData = $template->getData();
             }
         }
     } else {
         $id = null;
         $templates = Templates\SingletonCollection::getInstance();
         $templateData = $templates->getTemplate($templateId)->getData();
     }
     $from = empty($p['from']) ? '' : $p['from'];
     if (!empty($from)) {
         if (isset($templateData['cfg']['object_plugins'])) {
             $op = $templateData['cfg']['object_plugins'];
             if (!empty($op[$from])) {
                 $objectPlugins = $op[$from];
             } else {
                 //check if config has only numeric keys, i.e. plugins specified directly (without a category)
                 if (!Util\isAssocArray($op)) {
                     $objectPlugins = $op;
                 } else {
                     $objectPlugins = Config::getObjectTypePluginsConfig(@$templateData['type'], $from);
                 }
             }
         }
     }
     if (empty($objectPlugins)) {
         if (!empty($templateData['cfg']['object_plugins'])) {
             $objectPlugins = $templateData['cfg']['object_plugins'];
         } else {
             $objectPlugins = Config::getObjectTypePluginsConfig($templateData['type'], $from);
         }
     }
     $rez['success'] = true;
     if (empty($objectPlugins)) {
         return $rez;
     }
     foreach ($objectPlugins as $pluginName) {
         $class = '\\CB\\Objects\\Plugins\\' . ucfirst($pluginName);
         $pClass = new $class($id);
         $prez = $pClass->getData();
         $rez['data'][$pluginName] = $prez;
     }
     return $rez;
 }
開發者ID:ameliefranco,項目名稱:casebox,代碼行數:76,代碼來源:Objects.php


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