1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-16 03:34:33 +02:00
This commit is contained in:
Ryan Cramer
2019-09-26 14:38:34 -04:00
parent 648d2731d5
commit 5586dd074b

View File

@@ -1435,25 +1435,27 @@ class Page extends WireData implements \Countable, WireMatchable {
$keys = explode('|', $multiKey); $keys = explode('|', $multiKey);
foreach($keys as $key) { foreach($keys as $key) {
$value = $this->getUnformatted($key); $v = $this->getUnformatted($key);
if(is_object($value)) { if(is_array($v) || $v instanceof WireArray) {
// like LanguagesPageFieldValue or WireArray // array or WireArray
$str = trim((string) $value); if(!count($v)) continue;
} else if(is_object($v)) {
// like LanguagesPageFieldValue
$str = trim((string) $v);
if(!strlen($str)) continue; if(!strlen($str)) continue;
} else if(is_array($value)) { } else if(is_string($v)) {
// array with no items $v = trim($v);
if(!count($value)) continue;
} else if(is_string($value)) {
$value = trim($value);
} }
if($value) { if($v) {
if($this->outputFormatting) $value = $this->get($key); if($this->outputFormatting) {
if($value) { $v = $this->get($key);
if($getKey) $value = $key; }
if($v) {
$value = $getKey ? $key : $v;
break; break;
} }
} }