2016-08-19 00:51:35 +02:00
|
|
|
<?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);
|
|
|
|
}
|
2016-08-19 00:51:35 +02:00
|
|
|
|
2020-04-20 19:58:09 +02:00
|
|
|
public function FieldHolder($properties = [])
|
2016-11-29 00:31:16 +01:00
|
|
|
{
|
|
|
|
// This gives us support for sub-tabs.
|
2018-10-20 19:49:21 +02:00
|
|
|
$tag = $this->getTabSet() ? 'h2>' : 'h1>';
|
2016-11-29 00:31:16 +01:00
|
|
|
$retVal = '';
|
2018-10-20 19:49:21 +02:00
|
|
|
foreach ($this->getChildren() as $tab) {
|
2016-11-29 00:31:16 +01:00
|
|
|
$retVal .= "<$tag" . $tab->Title() . "</$tag\n";
|
|
|
|
$retVal .= $tab->FieldHolder();
|
|
|
|
}
|
|
|
|
return $retVal;
|
|
|
|
}
|
2016-08-19 00:51:35 +02:00
|
|
|
}
|