<?php

namespace Engine\Form\Container;

/**
 * This container will render each child container as a column in a <table> element
 * @author Lucian
 */
class Columns extends \Engine\Form\Container\GeneralAbstract
{
	public $class = "columns";


	/**
	 * (non-PHPdoc)
	 * @see \Engine\Form\Container\GeneralAbstract::getTemplateParams()
	 */
	public function getTemplateParams($templateClass = null, $parentElement = null)
	{
		$params = parent::getTemplateParams($templateClass, $parentElement);

		$params['totalColumns'] = count(array_filter($this->getChilds(), function($child) {
			return $child->isContainer();
		}));

		return $params;
	}
}
