本文整理汇总了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;
}