本文整理汇总了PHP中VardefManager::addTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP VardefManager::addTemplate方法的具体用法?PHP VardefManager::addTemplate怎么用?PHP VardefManager::addTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VardefManager
的用法示例。
在下文中一共展示了VardefManager::addTemplate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createVardef
/**
* this method is called within a vardefs.php file which extends from a SugarObject.
* It is meant to load the vardefs from the SugarObject.
*/
function createVardef($module, $object, $templates = array('default'), $object_name = false)
{
global $dictionary;
//reverse the sort order so priority goes highest to lowest;
$templates = array_reverse($templates);
foreach ($templates as $template) {
VardefManager::addTemplate($module, $object, $template, $object_name);
}
LanguageManager::createLanguageFile($module, $templates);
$vardef_paths = array('custom/modules/' . $module . '/Ext/Vardefs/vardefs.ext.php', 'custom/Extension/modules/' . $module . '/Ext/Vardefs/vardefs.php');
//search a predefined set of locations for the vardef files
foreach ($vardef_paths as $path) {
if (file_exists($path)) {
require $path;
}
}
}
示例2: createVardef
/**
* this method is called within a vardefs.php file which extends from a SugarObject.
* It is meant to load the vardefs from the SugarObject.
*
* @param string $module
* @param string $object
* @param array $templates
* @param bool $object_name
*/
static function createVardef($module, $object, $templates = ['default'], $object_name = false)
{
global $dictionary;
include_once 'modules/TableDictionary.php';
//reverse the sort order so priority goes highest to lowest;
$templates = array_reverse($templates);
foreach ($templates as $template) {
VardefManager::addTemplate($module, $object, $template, $object_name);
}
LanguageManager::createLanguageFile($module, $templates);
if (isset(VardefManager::$custom_disabled_modules[$module])) {
$vardef_paths = ['custom/modules/' . $module . '/Ext/Vardefs/vardefs.ext.php', 'custom/Extension/modules/' . $module . '/Ext/Vardefs/vardefs.php'];
//search a predefined set of locations for the vardef files
foreach ($vardef_paths as $path) {
if (file_exists($path)) {
require $path;
}
}
}
}
示例3: addTemplate
static function addTemplate($module, $object, $template, $object_name = false)
{
// Normalize the template name
if ($template == 'default') {
$template = 'basic';
}
// The ActivityStream has subdirectories but this code doesn't expect it
// let's fix it up here
if (strpos($module, '/') !== false) {
$tmp = explode('/', $module);
$module = array_pop($tmp);
}
// Verify that we should use this template for BWC modules
if (self::ignoreBWCTemplate($module, $template)) {
return;
}
$templates = array();
$fields = array();
if (empty($object_name)) {
$object_name = $object;
}
$_object_name = strtolower($object_name);
if (!empty($GLOBALS['dictionary'][$object]['table'])) {
$table_name = $GLOBALS['dictionary'][$object]['table'];
} else {
$table_name = strtolower($module);
}
if (empty($templates[$template])) {
foreach (SugarAutoLoader::existingCustom('include/SugarObjects/templates/' . $template . '/vardefs.php', 'include/SugarObjects/implements/' . $template . '/vardefs.php') as $path) {
require $path;
$templates[$template] = $vardefs;
}
}
if (!empty($templates[$template])) {
static $merge_types = array('fields', 'relationships', 'indices', 'name_format_map', 'visibility', 'acls');
foreach ($merge_types as $merge_type) {
if (empty($GLOBALS['dictionary'][$object][$merge_type])) {
$GLOBALS['dictionary'][$object][$merge_type] = array();
}
if (!empty($templates[$template][$merge_type]) && is_array($templates[$template][$merge_type])) {
$GLOBALS['dictionary'][$object][$merge_type] = array_merge($templates[$template][$merge_type], $GLOBALS['dictionary'][$object][$merge_type]);
}
}
/* The duplicate_check property is inherited in full unless already defined - merge has no meaning here */
if (empty($GLOBALS['dictionary'][$object]['duplicate_check']) && !empty($templates[$template]['duplicate_check'])) {
$GLOBALS['dictionary'][$object]['duplicate_check'] = $templates[$template]['duplicate_check'];
}
if (isset($templates[$template]['favorites']) && !isset($GLOBALS['dictionary'][$object]['favorites'])) {
$GLOBALS['dictionary'][$object]['favorites'] = $templates[$template]['favorites'];
}
// maintain a record of this objects inheritance from the SugarObject templates...
$GLOBALS['dictionary'][$object]['templates'][$template] = $template;
if (!empty($templates[$template]['uses'])) {
foreach ($templates[$template]['uses'] as $extraTemplate) {
VardefManager::addTemplate($module, $object, $extraTemplate, $object_name);
}
}
}
}