本文整理汇总了PHP中Kurogo::getModuleSections方法的典型用法代码示例。如果您正苦于以下问题:PHP Kurogo::getModuleSections方法的具体用法?PHP Kurogo::getModuleSections怎么用?PHP Kurogo::getModuleSections使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kurogo
的用法示例。
在下文中一共展示了Kurogo::getModuleSections方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDetailGroups
protected function getDetailGroups(KurogoDataObject $object, $configName)
{
$detailFields = Kurogo::getModuleSections($configName, $this->configModule);
$groups = array();
foreach ($detailFields as $key => $keyData) {
$group = Kurogo::arrayVal($keyData, 'group', 0);
$grouptype = Kurogo::arrayVal($keyData, 'grouptype', 'navlist');
//get the object we're using for this field
$keyObject = $this->getObject($object, $keyData);
if ($listType = Kurogo::arrayVal($keyData, 'list-type')) {
$groupObjects = $this->getObjectField($keyObject, $key);
if (!is_array($groupObjects)) {
throw new KurogoException("Result of " . get_class($keyObject) . " {$key} did not return an array");
}
foreach ($groupObjects as $objectKey => $groupObject) {
$_groups = $this->getDetailGroups($groupObject, 'list-' . $listType);
foreach ($_groups as $_groupKey => $_groupData) {
$groupObjectKey = $objectKey . '-' . $_groupKey;
$groupOptions = array('object' => $groupObject, 'group' => $groupObjectKey, 'groupkey' => $_groupKey);
$groups[$groupObjectKey] = array_merge($groupOptions, $_groupData);
}
}
break;
} else {
if (!isset($groups[$group])) {
$groups[$group] = array();
}
if (isset($keyData['groupheading'])) {
$groups[$group]['groupheading'] = $keyData['groupheading'];
unset($keyData['groupheading']);
} elseif (isset($keyData['groupheadingfield'])) {
$groups[$group]['groupheading'] = $this->getObjectField($keyObject, $keyData['groupheadingfield']);
unset($keyData['groupheadingfield']);
}
if (isset($keyData['groupsubheading'])) {
$groups[$group]['groupsubheading'] = $keyData['groupsubheading'];
unset($keyData['groupsubheading']);
} elseif (isset($keyData['groupsubheadingfield'])) {
$groups[$group]['groupsubheading'] = $this->getObjectField($keyObject, $keyData['groupsubheadingfield']);
unset($keyData['groupsubheadingfield']);
}
if (isset($keyData['subTitleNewline'])) {
$groups[$group]['subTitleNewline'] = $keyData['subTitleNewline'];
unset($keyData['subTitleNewline']);
}
switch ($grouptype) {
case 'html':
$groups[$group] = array_merge($groups[$group], $keyData);
$groups[$group]['html'] = $this->getObjectField($keyObject, $key);
$groups[$group]['type'] = $grouptype;
$groups[$group]['field'] = $key;
break;
case 'navlist':
case 'list':
$groups[$group]['type'] = $grouptype;
$groups[$group]['fields'][$key] = $keyData;
break;
default:
throw new KurogoConfigurationException("Invalid grouptype {$grouptype} for {$key}");
}
}
}
return $groups;
}