/** * Renders SortingViewHelper * * Sets additional template variables for children of this viewhelper. * * @param Tx_PtExtlist_Domain_Model_List_Header_ListHeader $headers * @param Tx_PtExtlist_Domain_Model_List_Row $captions * @param string $headerKey * @param string $captionKey */ public function render(Tx_PtExtlist_Domain_Model_List_Header_ListHeader $headers, Tx_PtExtlist_Domain_Model_List_Row $captions, $headerKey = 'header', $captionKey = "caption") { if ($headers === NULL || $captions === NULL) { return ''; } $output = ''; foreach ($headers as $header) { /* @var $header Tx_PtExtlist_Domain_Model_List_Header_HeaderColumn */ if ($captions->hasItem($header->getColumnIdentifier()) && !in_array($header->getColumnIdentifier(), $this->arguments['exclude'])) { // Set additional variables in template vars for child elements $this->templateVariableContainer->add($captionKey, $captions->getItemById($header->getColumnIdentifier())); $this->templateVariableContainer->add('header', $header); $this->templateVariableContainer->add('sortable', $header->isSortable()); $this->templateVariableContainer->add('sortingFields', $this->buildSortingFieldParams($header)); $this->templateVariableContainer->add('sortColumnAtOnce', $header->getSortingConfig()->getColumnSorting()); $output .= $this->renderChildren(); $this->templateVariableContainer->remove('sortColumnAtOnce'); $this->templateVariableContainer->remove('sortingFields'); $this->templateVariableContainer->remove($captionKey); $this->templateVariableContainer->remove($headerKey); $this->templateVariableContainer->remove('sortable'); } } return $output; }