src/View.php
public function getClosestOwner($object, $class)
    {
        if (!isset($object->owner)) {
            return;
        }

        if ($object->owner instanceof $class) {
            return $object->owner;
        }

        return $this->getClosestOwner($object->owner, $class);
    }
public function getClosestOwner($object, $class)
    {
        if (!isset($object->owner)) {
            return;
        }

        if ($object->owner instanceof $class) {
            return $object->owner;
        }

        return $this->getClosestOwner($object->owner, $class);
    }
public function getClosestOwner ( $ object , $ class ) { if ( ! isset ( $ object -> owner ) ) { return ; } if ( $ object -> owner instanceof $ class ) { return $ object -> owner ; } return $ this -> getClosestOwner ( $ object -> owner , $ class ) ; }
Get objects closest owner which is instance of particular class.

If there are no such owner (or grand-owner etc.) object, then return.

Note: this is internal method, but should be public because other objects
should be able to call it.

@param \atk4\ui\View $object
@param string        $class

@return null|\atk4\ui\View
Get objects closest owner which is instance of particular class .