1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-12 09:44:38 +02:00
This commit is contained in:
Ryan Cramer
2023-10-06 10:52:48 -04:00
parent 3cc76cc886
commit 173f1b1b29

View File

@@ -861,11 +861,11 @@ class PagesRawFinder extends Wire {
protected function findCustom() {
if(count($this->customFields)) {
// one or more custom fields requested
if($this->ids === null) {
if($this->ids === null && !empty($this->selector)) {
// only find IDs if we didnt already in the nativeFields section
$this->setIds($this->findIDs($this->selector, false));
}
if(!count($this->ids)) return;
if(empty($this->ids)) return;
foreach($this->customFields as $fieldName => $field) {
/** @var Field $field */
$cols = isset($this->customCols[$fieldName]) ? $this->customCols[$fieldName] : array();
@@ -1144,11 +1144,12 @@ class PagesRawFinder extends Wire {
$this->wire($finder);
$options = $this->options;
$options['indexed'] = true;
$pageRefRows = $finder->find($pageRefIds, $pageRefCols, $options);
$pageRefRows = count($pageRefIds) ? $finder->find($pageRefIds, $pageRefCols, $options) : array();
foreach($this->values as $pageId => $pageRow) {
if(!isset($pageRow[$fieldName])) continue;
foreach($pageRow[$fieldName] as $pageRefId) {
if(!isset($pageRefRows[$pageRefId])) continue;
$this->values[$pageId][$fieldName][$pageRefId] = $pageRefRows[$pageRefId];
}
if(!$this->getMultiple && $field->get('derefAsPage') > 0) {