Permalink
Browse files

feature(widgets): added isset on \ElggWidget objects to check settings

fixes #9590
  • Loading branch information...
jdalsem committed Mar 29, 2016
1 parent 50721e5 commit 7b0952088d94f2132917f2b3cdd9f328726595be
Showing with 21 additions and 0 deletions.
  1. +21 −0 engine/classes/ElggWidget.php
@@ -113,6 +113,27 @@ public function __unset($name) {
$this->removePrivateSetting($name);
}
}
+
+ /**
+ * Test if property is set either as an attribute or private setting
+ *
+ * @tip Use isset($entity->property)
+ *
+ * @see \ElggEntity->__isset
+ *
+ * @param string $name The name of the attribute or private setting.
+ *
+ * @return bool
+ * @since 2.2.0
+ */
+ public function __isset($name) {
+ if (array_key_exists($name, $this->attributes)) {
+ return parent::__isset($name);
+ } else {
+ $private_setting = $this->getPrivateSetting($name);
+ return !is_null($private_setting);
+ }
+ }
/**
* Set the widget context

0 comments on commit 7b09520

Please sign in to comment.