parents-merge 36164 - Added FieldGroup->subfieldParam option, defaulting to SmallFieldHolder

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@45054 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2007-11-19 01:51:32 +00:00
parent be3ed220ac
commit 98fdd637ad

View File

@ -7,8 +7,8 @@
* SmallFieldHolder() is called, which just prefixes $Field with a <label> tag, if the Title is set.
*/
class FieldGroup extends CompositeField {
protected $zebra;
public $subfieldParam = "SmallFieldHolder";
function __construct($arg1 = null, $arg2 = null) {
if(is_array($arg1) || is_a($arg1, 'FieldSet')) {
@ -55,6 +55,8 @@ class FieldGroup extends CompositeField {
* it is easier to overwrite the <div class="field"> behaviour in a more specific class
*/
function Field() {
$subfieldParam = $this->subfieldParam;
$fs = $this->FieldSet();
$spaceZebra = isset($this->zebra) ? " $this->zebra" : '';
$idAtt = isset($this->id) ? " id=\"{$this->id}\"" : '';
@ -62,7 +64,7 @@ class FieldGroup extends CompositeField {
foreach($fs as $subfield) {
$childZebra = (!isset($childZebra) || $childZebra == "odd") ? "even" : "odd";
if($subfield->hasMethod('setZebra')) $subfield->setZebra($childZebra);
$content .= $subfield->SmallFieldHolder() . " ";
$content .= $subfield->$subfieldParam() . " ";
}
$content .= "</span>";
return $content;