本文整理汇总了PHP中CB\Config::extend方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::extend方法的具体用法?PHP Config::extend怎么用?PHP Config::extend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CB\Config
的用法示例。
在下文中一共展示了Config::extend方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adjustViewConfig
/**
* analize and adjust view config if needed
* @param array $viewConfig
* @param array $rp
* @return array
*/
public function adjustViewConfig($viewConfig, &$rp)
{
if (empty($viewConfig)) {
return array();
}
$rez = $viewConfig;
$cfg =& $this->config;
if (!empty($cfg['views'][$rez['type']])) {
$rez = array_merge($rez, $cfg['views'][$rez['type']]);
} elseif ($rez['type'] == 'activityStream' && !empty($cfg['views']['stream'])) {
$rez = array_merge($rez, $cfg['views']['stream']);
}
//dashboards extention check
if (!empty($rez['extends'])) {
$rez = Config::extend('dashboards', $rez);
}
switch ($rez['type']) {
//backward compatibility check
case 'pivot':
case 'charts':
if (!empty($cfg['stats'])) {
$stats = array();
foreach ($cfg['stats'] as $item) {
$stats[] = array('title' => Util\detectTitle($item), 'field' => $item['field']);
}
$rez['stats'] = $stats;
}
$rez['sort'] = null;
//check renamed options
if (isset($rez['chart_type']) && empty($rez['chartType'])) {
$rez['chartType'] = $rez['chart_type'];
unset($rez['chart_type']);
}
if (isset($rez['pivot_type']) && empty($rez['pivotType'])) {
$rez['pivotType'] = $rez['pivot_type'];
unset($rez['pivot_type']);
}
break;
case 'dashboard':
//analize dashboard items and merge referenced config if any
if (empty($rez['items'])) {
$rez['items'] = array();
}
$this->subClasses = array();
$copyConfigProperties = ['title', 'cellCls', 'rowspan', 'colspan', 'width', 'height', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight'];
foreach ($rez['items'] as $k => $v) {
if (!empty($v['extends'])) {
$rez['items'][$k] = Config::extend('treeNodes', $v);
}
$clsArr = Path::getNodeClasses($rez['items']);
if (!empty($clsArr)) {
$class = current($clsArr);
if (isset($v['pid'])) {
$class->id = $v['pid'];
}
$this->subClasses[$k] = $class;
$path = array($class);
$customRp = $rp;
unset($customRp['userViewChange']);
$vc = $class->getViewConfig($path, $customRp);
$rez['items'][$k] = array_merge($vc, array_intersect_key($v, array_flip($copyConfigProperties)));
}
}
break;
default:
// grid
// if (!empty($cfg['view']['group'])) {
// $rez['group'] = $cfg['view']['group'];
// }
}
return $rez;
}