public function init()
    {
        // set name and id of view
        if (!$this->name) {
            if (!$this->id) {
                $this->id = $this->name = 'atk';
            } else {
                $this->name = $this->id;
            }
        } elseif (!$this->id) {
            $this->id = $this->name;
        }

        // initialize
        $this->_init();

        if (!$this->app) {
            $this->initDefaultApp();
        }

        if ($this->region && !$this->template && !$this->defaultTemplate && $this->owner && $this->owner->template) {
            $this->template = $this->owner->template->cloneRegion($this->region);

            $this->owner->template->del($this->region);
        } else {
            // set up template
            if (is_string($this->defaultTemplate) && is_null($this->template)) {
                $this->template = $this->app->loadTemplate($this->defaultTemplate);
            }

            if (!$this->region) {
                $this->region = 'Content';
            }
        }

        if ($this->template && !isset($this->template->app) && isset($this->app)) {
            $this->template->app = $this->app;
        }

        // add default objects
        foreach ($this->_add_later as list($object, $region)) {
            $this->add($object, $region);
        }

        $this->_add_later = [];
    }