From f57424a91a5f53a435fb2c0d887df4c21a68a61c Mon Sep 17 00:00:00 2001 From: Henning Leutz <leutz@pcsg.de> Date: Fri, 5 Feb 2016 08:05:05 +0100 Subject: [PATCH] get instance of -> into bricks --- src/QUI/Bricks/Brick.php | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/QUI/Bricks/Brick.php b/src/QUI/Bricks/Brick.php index 7a92874..dc0fd4a 100644 --- a/src/QUI/Bricks/Brick.php +++ b/src/QUI/Bricks/Brick.php @@ -61,15 +61,15 @@ public function __construct($params = array()) { // default $default = array( - 'type' => 'content', - 'content' => '', - 'title' => '', + 'type' => 'content', + 'content' => '', + 'title' => '', 'description' => '', - 'project' => '', - 'areas' => '', - 'height' => '', - 'width' => '', - 'classes' => '' + 'project' => '', + 'areas' => '', + 'height' => '', + 'width' => '', + 'classes' => '' ); $this->setAttributes($default); @@ -154,6 +154,23 @@ public function getType() return get_class($this); } + /** + * Checks if the internal control is of this class or has this class as one of its parents + * + * @param string $className + * @return bool + */ + public function isInstanceOf($className) + { + $Control = $this->getControl(); + + if (is_object($Control)) { + return $Control instanceof $className; + } + + return $this instanceof $className; + } + /** * Check, if control canbe created * -- GitLab