src/View.php
public function add($seed, $region = null)
    {
        if ($this->_rendered) {
            throw new Exception('You cannot add anything into the view after it was rendered');
        }
        if (!$this->app) {
            $this->_add_later[] = [$seed, $region];

            return $seed;
        }

        if (is_array($region)) {
            $args = $region;
            if (isset($args['region'])) {
                $region = ['region'=>$args['region']];
                unset($args['region']);
            }
        } elseif ($region) {
            $args = null;
            $region = ['region'=>$region];
        } else {
            $args = null;
            $region = null;
        }

        // Create object first
        $object = $this->factory($this->mergeSeeds($seed, ['View']), $region);

        // Will call init() of the object
        $object = $this->_add($object, $args);

        return $object;
    }
public function add($seed, $region = null)
    {
        if ($this->_rendered) {
            throw new Exception('You cannot add anything into the view after it was rendered');
        }
        if (!$this->app) {
            $this->_add_later[] = [$seed, $region];

            return $seed;
        }

        if (is_array($region)) {
            $args = $region;
            if (isset($args['region'])) {
                $region = ['region'=>$args['region']];
                unset($args['region']);
            }
        } elseif ($region) {
            $args = null;
            $region = ['region'=>$region];
        } else {
            $args = null;
            $region = null;
        }

        // Create object first
        $object = $this->factory($this->mergeSeeds($seed, ['View']), $region);

        // Will call init() of the object
        $object = $this->_add($object, $args);

        return $object;
    }
public function add ( $ seed , $ region = null ) { if ( $ this -> _rendered ) { throw new Exception ( 'You cannot add anything into the view after it was rendered' ) ; } if ( ! $ this -> app ) { $ this -> _add_later [ ] = [ $ seed , $ region ] ; return $ seed ; } if ( is_array ( $ region ) ) { $ args = $ region ; if ( isset ( $ args [ 'region' ] ) ) { $ region = [ 'region' => $ args [ 'region' ] ] ; unset ( $ args [ 'region' ] ) ; } } elseif ( $ region ) { $ args = null ; $ region = [ 'region' => $ region ] ; } else { $ args = null ; $ region = null ; } // Create object first $ object = $ this -> factory ( $ this -> mergeSeeds ( $ seed , [ 'View' ] ) , $ region ) ; // Will call init() of the object $ object = $ this -> _add ( $ object , $ args ) ; return $ object ; }
In addition to adding a child object, sets up it's template
and associate it's output with the region in our template.

@param mixed  $seed   New object to add
@param string $region

@throws Exception

@return View
In addition to adding a child object sets up it s template and associate it s output with the region in our template .