ENHANCEMENT Added FieldSet->removeFieldsFromTab() which does exactly what removeFieldFromTab() does, but with an array of field names

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@61157 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2008-08-20 05:03:50 +00:00
parent 2b49d18350
commit d69c3d6a1a

View File

@ -85,6 +85,23 @@ class FieldSet extends DataObjectSet {
$tab->removeByName($fieldName);
}
/**
* Removes a number of fields from a Tab/TabSet within this FieldSet.
*
* @param string $tabName The name of the Tab or TabSet field
* @param array $fields A list of fields, e.g. array('Name', 'Email')
*/
public function removeFieldsFromTab($tabName, $fields) {
// This is a cache that must be flushed
$this->sequentialSet = null;
// Find the tab
$tab = $this->findOrMakeTab($tabName);
// Add the fields to the end of this set
foreach($fields as $field) $tab->removeByName($field);
}
/**
* Remove a field from this fieldset by name.
* It musn't be buried in a composite field.--- changed