mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX #6299 TableListField::Link() includes $action value twice (thanks ajshort!)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@115379 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c3f915c4d5
commit
cc12a7baf0
@ -1197,7 +1197,7 @@ JS
|
|||||||
$queryPart = (isset($parentUrlParts['query'])) ? '?' . $parentUrlParts['query'] : null;
|
$queryPart = (isset($parentUrlParts['query'])) ? '?' . $parentUrlParts['query'] : null;
|
||||||
// Ensure that URL actions not routed through Form->httpSubmission() are protected against CSRF attacks.
|
// Ensure that URL actions not routed through Form->httpSubmission() are protected against CSRF attacks.
|
||||||
if($form->securityTokenEnabled()) $queryPart = $token->addtoUrl($queryPart);
|
if($form->securityTokenEnabled()) $queryPart = $token->addtoUrl($queryPart);
|
||||||
return Controller::join_links($parentUrlParts['path'], $action, $queryPart);
|
return Controller::join_links($parentUrlParts['path'], $queryPart);
|
||||||
} else {
|
} else {
|
||||||
// allow for instanciation of this FormField outside of a controller/form
|
// allow for instanciation of this FormField outside of a controller/form
|
||||||
// context (e.g. for unit tests)
|
// context (e.g. for unit tests)
|
||||||
|
@ -216,7 +216,26 @@ class TableListFieldTest extends SapphireTest {
|
|||||||
|
|
||||||
unlink($csvFileName);
|
unlink($csvFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testLink() {
|
||||||
|
// A TableListField must be inside a form for its links to be generated
|
||||||
|
$form = new Form(new TableListFieldTest_TestController(), "TestForm", new FieldSet(
|
||||||
|
new TableListField("Tester", "TableListFieldTest_Obj", array(
|
||||||
|
"A" => "Col A",
|
||||||
|
"B" => "Col B",
|
||||||
|
"C" => "Col C",
|
||||||
|
"D" => "Col D",
|
||||||
|
"E" => "Col E",
|
||||||
|
))
|
||||||
|
), new FieldSet());
|
||||||
|
|
||||||
|
$table = $form->dataFieldByName('Tester');
|
||||||
|
$this->assertEquals(
|
||||||
|
$table->Link('test'),
|
||||||
|
sprintf('TableListFieldTest_TestController/TestForm/field/Tester/test?SecurityID=%s', $form->dataFieldByName('SecurityID')->Value())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function testPreservedSortOptionsInPaginationLink() {
|
function testPreservedSortOptionsInPaginationLink() {
|
||||||
$item1 = $this->objFromFixture('TableListFieldTest_Obj', 'one');
|
$item1 = $this->objFromFixture('TableListFieldTest_Obj', 'one');
|
||||||
$item2 = $this->objFromFixture('TableListFieldTest_Obj', 'two');
|
$item2 = $this->objFromFixture('TableListFieldTest_Obj', 'two');
|
||||||
|
Loading…
Reference in New Issue
Block a user