renamed $wantDefaultAddRow to $showAddRow

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@48098 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-01-16 20:34:40 +00:00
parent 265d52d037
commit 3e9c02e183

View File

@ -83,12 +83,14 @@ class TableField extends TableListField {
protected $requiredFields = null; protected $requiredFields = null;
/** /**
* For some table, we want Can(add) to be true, so we can add, * Shows a row of empty fields for adding a new record
* but we don't want the default add row to be presented in the * (turned on by default).
* table, we can set this wantDefaultAddRow to be false. * Please use {@link TableField::$permissions} to control
* @param boolean $wantDefaultAddRow * if the "add"-functionality incl. button is shown at all.
*
* @param boolean $showAddRow
*/ */
protected $wantDefaultAddRow = true; public $showAddRow = true;
function __construct($name, $sourceClass, $fieldList, $fieldTypes, $filterField = null, function __construct($name, $sourceClass, $fieldList, $fieldTypes, $filterField = null,
$sourceFilter = null, $editExisting = true, $sourceSort = null, $sourceJoin = null) { $sourceFilter = null, $editExisting = true, $sourceSort = null, $sourceJoin = null) {
@ -179,7 +181,7 @@ class TableField extends TableListField {
} }
// Create a temporary DataObject // Create a temporary DataObject
if($this->Can('add')) { if($this->Can('add')) {
if($this->wantDefaultAddRow){ if($this->showAddRow){
$output->push(new TableField_Item(null, $this, null, $this->fieldTypes, true)); $output->push(new TableField_Item(null, $this, null, $this->fieldTypes, true));
} }
} }
@ -452,10 +454,6 @@ class TableField extends TableListField {
$this->extraData = $extraData; $this->extraData = $extraData;
} }
function setWantDefaultAddRow($bool){
$this->wantDefaultAddRow = $bool;
}
/** /**
* @return array * @return array
*/ */