public function addStack($blockName, array $args = array())
    {
        if (isset($this->plugins[$blockName])) {
            $class = $this->plugins[$blockName]['class'];
        } else {
            $class = current(array_filter([
                'Plugin' . self::toCamelCase($blockName),
                self::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . self::toCamelCase($blockName)
            ], 'class_exists'));
        }

        if ($this->curBlock !== null) {
            $this->curBlock->buffer(ob_get_contents());
            ob_clean();
        } else {
            $this->buffer .= ob_get_contents();
            ob_clean();
        }

        $block = new $class($this);

        call_user_func_array(array($block, 'init'), $args);

        $this->stack[] = $this->curBlock = $block;

        return $block;
    }
public function addStack($blockName, array $args = array())
    {
        if (isset($this->plugins[$blockName])) {
            $class = $this->plugins[$blockName]['class'];
        } else {
            $class = current(array_filter([
                'Plugin' . self::toCamelCase($blockName),
                self::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . self::toCamelCase($blockName)
            ], 'class_exists'));
        }

        if ($this->curBlock !== null) {
            $this->curBlock->buffer(ob_get_contents());
            ob_clean();
        } else {
            $this->buffer .= ob_get_contents();
            ob_clean();
        }

        $block = new $class($this);

        call_user_func_array(array($block, 'init'), $args);

        $this->stack[] = $this->curBlock = $block;

        return $block;
    }
public function addStack ( $ blockName , array $ args = array ( ) ) { if ( isset ( $ this -> plugins [ $ blockName ] ) ) { $ class = $ this -> plugins [ $ blockName ] [ 'class' ] ; } else { $ class = current ( array_filter ( [ 'Plugin' . self :: toCamelCase ( $ blockName ) , self :: NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . self :: toCamelCase ( $ blockName ) ] , 'class_exists' ) ) ; } if ( $ this -> curBlock !== null ) { $ this -> curBlock -> buffer ( ob_get_contents ( ) ) ; ob_clean ( ) ; } else { $ this -> buffer .= ob_get_contents ( ) ; ob_clean ( ) ; } $ block = new $ class ( $ this ) ; call_user_func_array ( array ( $ block , 'init' ) , $ args ) ; $ this -> stack [ ] = $ this -> curBlock = $ block ; return $ block ; }
Adds a block to the block stack.

@param string $blockName the block name (without `Plugin` prefix)
@param array  $args      the arguments to be passed to the block's init() function

@return BlockPlugin the newly created block
Adds a block to the block stack .