1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-13 18:24:57 +02:00

Minor optimization for Page::isLoaded($fieldName) method

This commit is contained in:
Ryan Cramer
2020-07-10 12:41:26 -04:00
parent f52a0685c2
commit f0f37853ca

View File

@@ -3819,7 +3819,10 @@ class Page extends WireData implements \Countable, WireMatchable {
*
*/
public function isLoaded($fieldName = null) {
if($fieldName) return parent::get($fieldName) !== null;
if($fieldName) {
if($this->hasField($fieldName)) return isset($this->data[$fieldName]);
return parent::get($fieldName) !== null;
}
return $this->isLoaded;
}