$contentProviders = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.content.userContentProvider');
- // sort object types
- uasort($contentProviders, function ($a, $b) {
- $niceValueA = ($a->nicevalue ?: 0);
- $niceValueB = ($b->nicevalue ?: 0);
-
- if ($niceValueA < $niceValueB) {
- return -1;
- }
- else if ($niceValueA > $niceValueB) {
- return 1;
- }
-
- return 0;
- });
-
// add the required object types for the select content provider
if (is_array($this->contentProvider)) {
foreach ($this->contentProvider as $contentProvider) {
throw new \RuntimeException('Unknown required object type "' . $objectTypeName . '" for object type "' . $contentProvider . '" given.');
}
- $this->contentProvider[] = $objectType;
+ $this->contentProvider[] = $objectTypeName;
}
}
}
if ($count) {
$this->data['provider'][$contentProvider->objectType] = [
'count' => $count,
- 'objectTypeID' => $contentProvider->objectTypeID
+ 'objectTypeID' => $contentProvider->objectTypeID,
+ 'nicevalue' => $contentProvider->nicevalue ?: 0
];
$this->data['count'] += ceil($count / $this->limit) * $this->limit;
}
}
}
+
+ // sort object types
+ uasort($this->data['provider'], function ($a, $b) {
+ $niceValueA = ($a['nicevalue'] ?: 0);
+ $niceValueB = ($b['nicevalue'] ?: 0);
+
+ if ($niceValueA < $niceValueB) {
+ return -1;
+ }
+ else if ($niceValueA > $niceValueB) {
+ return 1;
+ }
+
+ return 0;
+ });
}
/**
public function execute() {
if (empty($this->data['provider'])) {
return;
- }
+ }
$values = array_keys($this->data['provider']);
- $providerObjectType = array_pop($values);
+ $providerObjectType = array_shift($values);
/** @var IUserContentProvider $processor */
$processor = ObjectTypeCache::getInstance()->getObjectType($this->data['provider'][$providerObjectType]['objectTypeID'])->getProcessor();