src/Controller/Plugin/ContentCollector.php
public function trigger($event, $target = null)
    {
        if (empty($this->_template) || !is_string($this->_template)) {
            throw new \InvalidArgumentException('ContentCollector must have a template-name');
        }
          
        $responseCollection = $this->getController()->getEventManager()->trigger($event, $target);
        $viewModel = new ViewModel();
        $viewModel->setTemplate($this->_template);
        foreach ($responseCollection as $i => $response) {
            if (is_string($response)) {
                $template = $response;
                $response = new ViewModel(array('target' => $target));
                $response->setTemplate($template);
            }
            $viewModel->addChild($response, $this->_captureTo . $i);
        }
                
        return $viewModel;
    }
public function trigger($event, $target = null)
    {
        if (empty($this->_template) || !is_string($this->_template)) {
            throw new \InvalidArgumentException('ContentCollector must have a template-name');
        }
          
        $responseCollection = $this->getController()->getEventManager()->trigger($event, $target);
        $viewModel = new ViewModel();
        $viewModel->setTemplate($this->_template);
        foreach ($responseCollection as $i => $response) {
            if (is_string($response)) {
                $template = $response;
                $response = new ViewModel(array('target' => $target));
                $response->setTemplate($template);
            }
            $viewModel->addChild($response, $this->_captureTo . $i);
        }
                
        return $viewModel;
    }
public function trigger ( $ event , $ target = null ) { if ( empty ( $ this -> _template ) || ! is_string ( $ this -> _template ) ) { throw new \ InvalidArgumentException ( 'ContentCollector must have a template-name' ) ; } $ responseCollection = $ this -> getController ( ) -> getEventManager ( ) -> trigger ( $ event , $ target ) ; $ viewModel = new ViewModel ( ) ; $ viewModel -> setTemplate ( $ this -> _template ) ; foreach ( $ responseCollection as $ i => $ response ) { if ( is_string ( $ response ) ) { $ template = $ response ; $ response = new ViewModel ( array ( 'target' => $ target ) ) ; $ response -> setTemplate ( $ template ) ; } $ viewModel -> addChild ( $ response , $ this -> _captureTo . $ i ) ; } return $ viewModel ; }
Trigger capture event

@param   EventInterface $event
@param   mixed|null  $target

@return  ViewModel
Trigger capture event