1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-13 18:24:57 +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);
foreach($keys as $key) {
$value = $this->getUnformatted($key);
if(is_object($value)) {
// like LanguagesPageFieldValue or WireArray
$str = trim((string) $value);
$v = $this->getUnformatted($key);
if(is_array($v) || $v instanceof WireArray) {
// array or WireArray
if(!count($v)) continue;
} else if(is_object($v)) {
// like LanguagesPageFieldValue
$str = trim((string) $v);
if(!strlen($str)) continue;
} else if(is_array($value)) {
// array with no items
if(!count($value)) continue;
} else if(is_string($value)) {
$value = trim($value);
} else if(is_string($v)) {
$v = trim($v);
}
if($value) {
if($this->outputFormatting) $value = $this->get($key);
if($value) {
if($getKey) $value = $key;
if($v) {
if($this->outputFormatting) {
$v = $this->get($key);
}
if($v) {
$value = $getKey ? $key : $v;
break;
}
}