/** * Merge the templateMeta entry for the view defs. Only merge studio accessible * changes to the templateMeta. Upgrade entries should take precedence in all other * cases. */ protected function mergeTemplateMeta() { if (isset($this->customData[$this->module][$this->viewDefs][$this->templateMetaName]) && is_array($this->customData[$this->module][$this->viewDefs][$this->templateMetaName])) { $custTM =& $this->customData[$this->module][$this->viewDefs][$this->templateMetaName]; $newTM =& $this->newData[$this->module][$this->viewDefs][$this->templateMetaName]; $oldTM =& $this->originalData[$this->module][$this->viewDefs][$this->templateMetaName]; foreach ($custTM as $key => $value) { //Some sections we can always clone from custom to new if (in_array($key, $this->templateMetaVarsToMerge)) { $newTM[$key] = $value; } else { if (isset($oldTM[$key]) && !isset($newTM[$key])) { continue; } else { if (is_array($value)) { $newTM[$key] = MergeUtils::deepMergeDef(isset($oldTM[$key]) ? $oldTM[$key] : array(), isset($newTM[$key]) ? $newTM[$key] : array(), $value); } else { if (empty($newTM[$key]) && empty($oldTM[$key]) || !empty($newTM[$key]) && !empty($oldTM[$key]) && $newTM[$key] == $oldTM[$key]) { $newTM[$key] = $value; } } } } } } }
/** * Merges non 'panel' defs, combining custom into new defs then into the old * defs. * * @param array $oldDefs The previous instance view defs * @param array $newDefs The upgrade instance view defs * @param array $customDefs Customizations from the previous instance * * @return array A new custom set of viewdefs */ public function mergeOtherDefs($oldDefs, $newDefs, $customDefs) { $oDefs = $oldDefs[$this->moduleName][$this->clientType]['view'][$this->viewName]; $nDefs = $newDefs[$this->moduleName][$this->clientType]['view'][$this->viewName]; $cDefs = $customDefs[$this->moduleName][$this->clientType]['view'][$this->viewName]; if (!empty($cDefs)) { $merged = MergeUtils::deepMergeDef($oDefs, $nDefs, $cDefs); if (!empty($merged) && $merged != $cDefs) { $this->needSave = true; $customDefs[$this->moduleName][$this->clientType]['view'][$this->viewName] = $merged; } } return $customDefs; }