Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 43 lines (35 sloc) 1.062 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
<?php
/**
* Transformation that will make a form printable.
* Builds on readonly forms with different behaviour for tabsets.
* @package forms
* @subpackage transformations
*/
class PrintableTransformation extends ReadonlyTransformation {
public function transformTabSet($field) {
$transformedField = new PrintableTransformation_TabSet($field->Tabs()->transform($this));
$transformedField->Title = $field->Title();
$transformedField->TabSet = $field->TabSet;
return $transformedField;
}
}

/**
* Class representing printable tabsets
* @package forms
* @subpackage transformations
*/
class PrintableTransformation_TabSet extends TabSet {
public function __construct($tabs) {
$this->children = $tabs;
CompositeField::__construct($tabs);
}

public function FieldHolder($properties = array()) {
// This gives us support for sub-tabs.
$tag = ($this->tabSet) ? "h2>" : "h1>";

foreach($this->children as $tab) {
$retVal .= "<$tag" . $tab->Title() . "</$tag\n";
$retVal .= $tab->FieldHolder();
}
return $retVal;

}


}

Something went wrong with that request. Please try again.