本文整理汇总了PHP中TranslateUtils::getIcon方法的典型用法代码示例。如果您正苦于以下问题:PHP TranslateUtils::getIcon方法的具体用法?PHP TranslateUtils::getIcon怎么用?PHP TranslateUtils::getIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TranslateUtils
的用法示例。
在下文中一共展示了TranslateUtils::getIcon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatGroup
/**
* @param array|MessageGroup $mixed
* @param array $props List of props as the array keys
* @param int $depth
* @return array
*/
protected function formatGroup($mixed, $props, $depth = 0)
{
$params = $this->extractRequestParams();
// Default
$g = $mixed;
$subgroups = array();
// Format = tree and has subgroups
if (is_array($mixed)) {
$g = array_shift($mixed);
$subgroups = $mixed;
}
wfProfileIn(__METHOD__ . '-' . get_class($g));
$a = array();
$groupId = $g->getId();
wfProfileIn(__METHOD__ . '-basic');
if (isset($props['id'])) {
$a['id'] = $groupId;
}
if (isset($props['label'])) {
$a['label'] = $g->getLabel();
}
if (isset($props['description'])) {
$a['description'] = $g->getDescription();
}
if (isset($props['class'])) {
$a['class'] = get_class($g);
}
if (isset($props['namespace'])) {
$a['namespace'] = $g->getNamespace();
}
wfProfileOut(__METHOD__ . '-basic');
wfProfileIn(__METHOD__ . '-exists');
if (isset($props['exists'])) {
$a['exists'] = $g->exists();
}
wfProfileOut(__METHOD__ . '-exists');
wfProfileIn(__METHOD__ . '-icon');
if (isset($props['icon'])) {
$formats = TranslateUtils::getIcon($g, $params['iconsize']);
if ($formats) {
$a['icon'] = $formats;
}
}
wfProfileOut(__METHOD__ . '-icon');
wfProfileIn(__METHOD__ . '-priority');
if (isset($props['priority'])) {
$priority = MessageGroups::getPriority($g);
$a['priority'] = $priority ?: 'default';
}
if (isset($props['prioritylangs'])) {
$prioritylangs = TranslateMetadata::get($groupId, 'prioritylangs');
$a['prioritylangs'] = $prioritylangs ? explode(',', $prioritylangs) : false;
}
if (isset($props['priorityforce'])) {
$a['priorityforce'] = TranslateMetadata::get($groupId, 'priorityforce') === 'on';
}
wfProfileOut(__METHOD__ . '-priority');
wfProfileIn(__METHOD__ . '-workflowstates');
if (isset($props['workflowstates'])) {
$a['workflowstates'] = $this->getWorkflowStates($g);
}
wfProfileOut(__METHOD__ . '-workflowstates');
Hooks::run('TranslateProcessAPIMessageGroupsProperties', array(&$a, $props, $params, $g));
wfProfileOut(__METHOD__ . '-' . get_class($g));
// Depth only applies to tree format
if ($depth >= $params['depth'] && $params['format'] === 'tree') {
$a['groupcount'] = count($subgroups);
// Prevent going further down in the three
return $a;
}
// Always empty array for flat format, only sometimes for tree format
if ($subgroups !== array()) {
foreach ($subgroups as $sg) {
$a['groups'][] = $this->formatGroup($sg, $props);
}
$result = $this->getResult();
$result->setIndexedTagName($a['groups'], 'group');
}
return $a;
}