mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT: allowing empty children
ENHANCEMENT: added Fields() ENHANCEMENT: added linebreaks for html git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@43558 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
0a85936f2f
commit
53f75e957d
@ -45,6 +45,10 @@ class CompositeField extends FormField {
|
||||
public function setID($id) {
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
public function Field() {
|
||||
return $this->FieldHolder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the fields nested inside another DIV
|
||||
@ -53,18 +57,18 @@ class CompositeField extends FormField {
|
||||
$fs = $this->FieldSet();
|
||||
$idAtt = isset($this->id) ? " id=\"{$this->id}\"" : '';
|
||||
$className = ($this->columnCount) ? "field CompositeField {$this->extraClass()} multicolumn" : "field CompositeField {$this->extraClass()}";
|
||||
$content = "<div class=\"$className\"$idAtt>";
|
||||
$content = "<div class=\"$className\"$idAtt>\n";
|
||||
|
||||
foreach($fs as $subfield) {
|
||||
if($this->columnCount) {
|
||||
$className = "column{$this->columnCount}";
|
||||
if(!next($fs)) $className .= " lastcolumn";
|
||||
$content .= "<div class=\"{$className}\">" . $subfield->FieldHolder() . "</div>";
|
||||
$content .= "\n<div class=\"{$className}\">\n" . $subfield->FieldHolder() . "\n</div>\n";
|
||||
} else if($subfield){
|
||||
$content .= $subfield->FieldHolder() . " ";
|
||||
$content .= "\n" . $subfield->FieldHolder() . "\n";
|
||||
}
|
||||
}
|
||||
$content .= "</div>";
|
||||
$content .= "</div>\n";
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user