silverstripe-framework/src/Forms/PrintableTransformation_TabSet.php

31 lines
683 B
PHP
Raw Normal View History

<?php
namespace SilverStripe\Forms;
/**
* Class representing printable tabsets
*/
class PrintableTransformation_TabSet extends TabSet
{
2016-11-29 00:31:16 +01:00
/**
* @param array $tabs
*/
public function __construct($tabs)
{
$this->children = $tabs;
CompositeField::__construct($tabs);
}
public function FieldHolder($properties = [])
2016-11-29 00:31:16 +01:00
{
// This gives us support for sub-tabs.
$tag = $this->getTabSet() ? 'h2>' : 'h1>';
2016-11-29 00:31:16 +01:00
$retVal = '';
foreach ($this->getChildren() as $tab) {
2016-11-29 00:31:16 +01:00
$retVal .= "<$tag" . $tab->Title() . "</$tag\n";
$retVal .= $tab->FieldHolder();
}
return $retVal;
}
}