本文整理汇总了PHP中LanguageManager::createLanguageFile方法的典型用法代码示例。如果您正苦于以下问题:PHP LanguageManager::createLanguageFile方法的具体用法?PHP LanguageManager::createLanguageFile怎么用?PHP LanguageManager::createLanguageFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LanguageManager
的用法示例。
在下文中一共展示了LanguageManager::createLanguageFile方法的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: 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.
*/
static function createVardef($module, $object, $templates = array('default'), $object_name = false)
{
global $dictionary;
include_once 'modules/TableDictionary.php';
if (isset($GLOBALS['dictionary'][$object]['uses'])) {
// Load in the vardef 'uses' first
$templates = array_merge($GLOBALS['dictionary'][$object]['uses'], $templates);
unset($GLOBALS['dictionary'][$object]['uses']);
// createVardef auto-adds the 'default' template, so to avoid using it twice
// among avoiding using other templates twice let's make sure the templates
// are unique
$templates = array_unique($templates);
}
// Load up fields if there is a need for that. Introduced with the taggable
// template
if (isset($GLOBALS['dictionary'][$object]['load_fields'])) {
$lf = $GLOBALS['dictionary'][$object]['load_fields'];
// Make sure we actually have a fields array to work with
if (empty($GLOBALS['dictionary'][$object]['fields'])) {
$GLOBALS['dictionary'][$object]['fields'] = array();
}
if (is_string($lf) && function_exists($lf)) {
// Merge fields from the function onto the known fields
$GLOBALS['dictionary'][$object]['fields'] = array_merge($GLOBALS['dictionary'][$object]['fields'], $lf());
} elseif (is_array($lf) && isset($lf['class']) && isset($lf['method'])) {
$class = $lf['class'];
$method = $lf['method'];
// Merge fields from the method call onto the known fields
$GLOBALS['dictionary'][$object]['fields'] = array_merge($GLOBALS['dictionary'][$object]['fields'], $class::$method());
}
}
//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);
}
// Some of the templates might have loaded templates
if (isset($GLOBALS['dictionary'][$object]['templates'])) {
$templates = $GLOBALS['dictionary'][$object]['templates'];
}
LanguageManager::createLanguageFile($module, $templates);
if (isset(VardefManager::$custom_disabled_modules[$module])) {
$vardef_paths = array(SugarAutoLoader::loadExtension("vardefs", $module), 'custom/Extension/modules/' . $module . '/Ext/Vardefs/vardefs.php');
//search a predefined set of locations for the vardef files
foreach ($vardef_paths as $path) {
// file_exists here is only for custom/Extension since loadExtension already checks
// the file map and will return false if something's wrong
if (!empty($path) && file_exists($path)) {
require $path;
}
}
}
// Handle unsetting of fields as per the defs. Do this last to make sure
// all extension fields have loaded
if (isset($GLOBALS['dictionary'][$object]['unset_fields'])) {
$uf = $GLOBALS['dictionary'][$object]['unset_fields'];
if (is_string($uf)) {
unset($GLOBALS['dictionary'][$object]['fields'][$uf]);
} elseif (is_array($uf)) {
foreach ($uf as $f) {
unset($GLOBALS['dictionary'][$object]['fields'][$f]);
}
}
}
}