Skip to content
This repository has been archived by the owner on Jul 10, 2020. It is now read-only.

Commit

Permalink
Merge pull request #62 from Maners/collection-template
Browse files Browse the repository at this point in the history
FormCollection: Set twb-layout on template element
  • Loading branch information
neilime committed Mar 19, 2014
2 parents 19460e2 + ffffdcb commit e7b90a1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/TwbBundle/Form/View/Helper/TwbBundleFormCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace TwbBundle\Form\View\Helper;

use Zend\Form\Element\Collection as CollectionElement;

class TwbBundleFormCollection extends \Zend\Form\View\Helper\FormCollection {

/**
Expand Down Expand Up @@ -89,4 +91,19 @@ public function render(\Zend\Form\ElementInterface $oElement) {
return $sMarkup;
}

/**
* Only render a template
*
* @param CollectionElement $collection
* @return string
*/
public function renderTemplate(CollectionElement $collection)
{
if($sElementLayout = $collection->getOption('twb-layout')) {
$elementOrFieldset = $collection->getTemplateElement();
$elementOrFieldset->setOption('twb-layout', $sElementLayout);
}

return parent::renderTemplate($collection);
}
}

0 comments on commit e7b90a1

Please sign in to comment.