mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-01 13:48:37 +02:00
bfojcapell: Added function SmallFieldHolder? to properly render fields when this function is called in a FieldGroup?.
Also added function insertBeforeRecursive (see www.silverstripe.com/google-summer-of-code-forum/show/3005). This function is only called in Translatable.php at this moment, so if finally insertBefore gets a recursive behaviour then the call can be changed and insertBeforeRecursive deleted. (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@42110 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a8433baee2
commit
864c0ba021
@ -69,6 +69,28 @@ class CompositeField extends FormField {
|
|||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the fields in the restricted field holder inside a DIV.
|
||||||
|
*/
|
||||||
|
function SmallFieldHolder() {//return $this->FieldHolder();
|
||||||
|
$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>";
|
||||||
|
|
||||||
|
foreach($fs as $subfield) {//echo ' subf'.$subfield->Name();
|
||||||
|
if($this->columnCount) {
|
||||||
|
$className = "column{$this->columnCount}";
|
||||||
|
if(!next($fs)) $className .= " lastcolumn";
|
||||||
|
$content .= "<div class=\"{$className}\">" . $subfield->FieldHolder() . "</div>";
|
||||||
|
} else if($subfield){
|
||||||
|
$content .= $subfield->SmallFieldHolder() . " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$content .= "</div>";
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Add all of the non-composite fields contained within this field to the list.
|
* Add all of the non-composite fields contained within this field to the list.
|
||||||
* Sequentialisation is used when connecting the form to its data source
|
* Sequentialisation is used when connecting the form to its data source
|
||||||
@ -108,7 +130,11 @@ class CompositeField extends FormField {
|
|||||||
$this->children->push($field);
|
$this->children->push($field);
|
||||||
}
|
}
|
||||||
public function insertBefore($field, $insertBefore) {
|
public function insertBefore($field, $insertBefore) {
|
||||||
$this->children->insertBefore($field, $insertBefore);
|
return $this->children->insertBefore($field, $insertBefore);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function insertBeforeRecursive($field, $insertBefore, $level = 0) {
|
||||||
|
return $this->children->insertBeforeRecursive($field, $insertBefore, $level+1);
|
||||||
}
|
}
|
||||||
public function removeByName($fieldName) {
|
public function removeByName($fieldName) {
|
||||||
$this->children->removeByName($fieldName);
|
$this->children->removeByName($fieldName);
|
||||||
|
Loading…
Reference in New Issue
Block a user