BUGFIX Fixed TableListField->Link() to allow for instanciation without a form/controller (e.g. for unit tests)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60757 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-08-14 08:19:02 +00:00
parent d38d7208b7
commit c706dbdcc1

View File

@ -1226,8 +1226,14 @@ class TableListField_Item extends ViewableData {
}
function Link() {
return Controller::join_links($this->parent->Link() . "item/" . $this->item->ID);
}
if($this->parent->getForm()) {
return Controller::join_links($this->parent->Link() . "item/" . $this->item->ID);
} else {
// allow for instanciation of this FormField outside of a controller/form
// context (e.g. for unit tests)
return false;
}
}
function BaseLink() {
user_error("TableListField_Item::BaseLink() deprecated, use Link() instead", E_USER_NOTICE);