AbstractView::recursiveRender PHP Method

recursiveRender() public method

function recursiveRender(){ $this->add('Text')->set('test'); return parent::recursiveRender(); // will render Text also } When cut_object is specified in the GET arguments, then output of HTML would be limited to object with matching $name or $short_name. This method will be called instead of default render() and it will stop rendering process and output object's HTML once it finds a suitable object. Exception_StopRender is used to terminate rendering process and bubble up to the APP. This exception is not an error.
public recursiveRender ( )
    public function recursiveRender()
    {
        if ($this->hook('pre-recursive-render')) {
            return;
        }
        $cutting_here = false;
        $cutting_output = '';
        $this->initTemplateTags();
        if (isset($_GET['cut_object']) && ($_GET['cut_object'] == $this->name || $_GET['cut_object'] == $this->short_name)) {
            // If we are cutting here, render childs and then we are done
            unset($_GET['cut_object']);
            $cutting_here = true;
            $this->addHook('output', function ($self, $output) use(&$cutting_output) {
                $cutting_output .= $output;
            });
        }
        if ($this->model && is_object($this->model) && $this->model->loaded()) {
            $this->modelRender();
        }
        foreach ($this->elements as $key => $obj) {
            if ($obj instanceof self) {
                $obj->recursiveRender();
                $obj->moveJStoParent();
            }
        }
        if (!isset($_GET['cut_object'])) {
            if (isset($_GET['cut_region'])) {
                $this->region_render();
            } else {
                $this->render();
            }
        }
        if ($cutting_here) {
            //$result=$this->owner->template->cloneRegion($this->spot)->render();
            if (isset($this->app->jquery)) {
                /** @type App_Web $this->app */
                $this->app->jquery->getJS($this);
            }
            throw new Exception_StopRender($cutting_output);
        }
        // if template wasn't cut, we move all JS chains to parent
    }

Usage Example

Example #1
0
 function recursiveRender()
 {
     if (isset($_GET['cut_page']) && !isset($_GET['cut_object']) && !isset($_GET['cut_region'])) {
         $_GET['cut_object'] = $this->short_name;
     }
     if ($this->title && $this->owner instanceof ApiFrontend) {
         $this->owner->template->trySet('page_title', $this->title);
     }
     parent::recursiveRender();
 }
All Usage Examples Of AbstractView::recursiveRender