mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Fixed deprecated usage of <% control %>
This commit is contained in:
parent
b8a51c3792
commit
0a9f3b75a9
@ -61,7 +61,7 @@ class CompositeField extends FormField {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the sub-fields, suitable for <% control FieldList %>
|
||||
* Returns all the sub-fields, suitable for <% loop FieldList %>
|
||||
*
|
||||
* @return FieldList
|
||||
*/
|
||||
|
@ -1227,7 +1227,7 @@ class Form extends RequestHandler {
|
||||
* Return a rendered version of this form.
|
||||
*
|
||||
* This is returned when you access a form as $FormObject rather
|
||||
* than <% control FormObject %>
|
||||
* than <% with FormObject %>
|
||||
*/
|
||||
public function forTemplate() {
|
||||
$return = $this->renderWith(array_merge(
|
||||
|
@ -206,7 +206,7 @@ class SSViewerCacheBlockTest extends SapphireTest {
|
||||
|
||||
public function testNoErrorMessageForControlWithinCached() {
|
||||
$this->_reset(true);
|
||||
$this->assertNotNull($this->_runtemplate('<% cached %><% control Foo %>$Bar<% end_control %><% end_cached %>'));
|
||||
$this->assertNotNull($this->_runtemplate('<% cached %><% with Foo %>$Bar<% end_with %><% end_cached %>'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -215,13 +215,13 @@ class SSViewerCacheBlockTest extends SapphireTest {
|
||||
public function testErrorMessageForCachedWithinControlWithinCached() {
|
||||
$this->_reset(true);
|
||||
$this->_runtemplate(
|
||||
'<% cached %><% control Foo %><% cached %>$Bar<% end_cached %><% end_control %><% end_cached %>');
|
||||
'<% cached %><% with Foo %><% cached %>$Bar<% end_cached %><% end_with %><% end_cached %>');
|
||||
}
|
||||
|
||||
public function testNoErrorMessageForCachedWithinControlWithinUncached() {
|
||||
$this->_reset(true);
|
||||
$this->assertNotNull($this->_runtemplate(
|
||||
'<% uncached %><% control Foo %><% cached %>$Bar<% end_cached %><% end_control %><% end_uncached %>'));
|
||||
'<% uncached %><% with Foo %><% cached %>$Bar<% end_cached %><% end_with %><% end_uncached %>'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -275,12 +275,12 @@ SS;
|
||||
);
|
||||
}
|
||||
|
||||
public function testControlWhitespace() {
|
||||
public function testLoopWhitespace() {
|
||||
$this->assertEquals(
|
||||
'before[out:SingleItem.Test]after
|
||||
beforeTestafter',
|
||||
$this->render('before<% control SingleItem %>$Test<% end_control %>after
|
||||
before<% control SingleItem %>Test<% end_control %>after')
|
||||
$this->render('before<% loop SingleItem %>$Test<% end_loop %>after
|
||||
before<% loop SingleItem %>Test<% end_loop %>after')
|
||||
);
|
||||
|
||||
// The control tags are removed from the output, but no whitespace
|
||||
@ -293,9 +293,9 @@ SS;
|
||||
|
||||
after',
|
||||
$this->render('before
|
||||
<% control SingleItem %>
|
||||
<% loop SingleItem %>
|
||||
$ItemOnItsOwnLine
|
||||
<% end_control %>
|
||||
<% end_loop %>
|
||||
after')
|
||||
);
|
||||
|
||||
@ -313,9 +313,9 @@ after')
|
||||
|
||||
after',
|
||||
$this->render('before
|
||||
<% control Loop3 %>
|
||||
<% loop Loop3 %>
|
||||
$ItemOnItsOwnLine
|
||||
<% end_control %>
|
||||
<% end_loop %>
|
||||
after')
|
||||
);
|
||||
}
|
||||
@ -328,28 +328,28 @@ after')
|
||||
[out:Foo(Arg1).Item]
|
||||
[out:Foo(Arg1,Arg2).Item]
|
||||
[out:Foo(Arg1,Arg2,Arg3).Item]',
|
||||
$this->render('<% control Foo.Bar %>a{$Item}b<% end_control %>
|
||||
<% control Foo.Bar(Arg1) %>$Item<% end_control %>
|
||||
<% control Foo(Arg1) %>$Item<% end_control %>
|
||||
<% control Foo(Arg1, Arg2) %>$Item<% end_control %>
|
||||
<% control Foo(Arg1, Arg2, Arg3) %>$Item<% end_control %>')
|
||||
$this->render('<% with Foo.Bar %>a{$Item}b<% end_with %>
|
||||
<% with Foo.Bar(Arg1) %>$Item<% end_with %>
|
||||
<% with Foo(Arg1) %>$Item<% end_with %>
|
||||
<% with Foo(Arg1, Arg2) %>$Item<% end_with %>
|
||||
<% with Foo(Arg1, Arg2, Arg3) %>$Item<% end_with %>')
|
||||
);
|
||||
|
||||
// Loop controls
|
||||
$this->assertEquals('a[out:Foo.Loop2.Item]ba[out:Foo.Loop2.Item]b',
|
||||
$this->render('<% control Foo.Loop2 %>a{$Item}b<% end_control %>'));
|
||||
$this->render('<% loop Foo.Loop2 %>a{$Item}b<% end_loop %>'));
|
||||
|
||||
$this->assertEquals('[out:Foo.Loop2(Arg1).Item][out:Foo.Loop2(Arg1).Item]',
|
||||
$this->render('<% control Foo.Loop2(Arg1) %>$Item<% end_control %>'));
|
||||
$this->render('<% loop Foo.Loop2(Arg1) %>$Item<% end_loop %>'));
|
||||
|
||||
$this->assertEquals('[out:Loop2(Arg1).Item][out:Loop2(Arg1).Item]',
|
||||
$this->render('<% control Loop2(Arg1) %>$Item<% end_control %>'));
|
||||
$this->render('<% loop Loop2(Arg1) %>$Item<% end_loop %>'));
|
||||
|
||||
$this->assertEquals('[out:Loop2(Arg1,Arg2).Item][out:Loop2(Arg1,Arg2).Item]',
|
||||
$this->render('<% control Loop2(Arg1, Arg2) %>$Item<% end_control %>'));
|
||||
$this->render('<% loop Loop2(Arg1, Arg2) %>$Item<% end_loop %>'));
|
||||
|
||||
$this->assertEquals('[out:Loop2(Arg1,Arg2,Arg3).Item][out:Loop2(Arg1,Arg2,Arg3).Item]',
|
||||
$this->render('<% control Loop2(Arg1, Arg2, Arg3) %>$Item<% end_control %>'));
|
||||
$this->render('<% loop Loop2(Arg1, Arg2, Arg3) %>$Item<% end_loop %>'));
|
||||
|
||||
}
|
||||
|
||||
|
@ -3544,7 +3544,7 @@ class SSTemplateParser extends Parser {
|
||||
* @deprecated
|
||||
*/
|
||||
function ClosedBlock_Handle_Control(&$res) {
|
||||
Deprecation::notice('3.1', 'Use <% with %> or <% loop %> instead.');
|
||||
Deprecation::notice('3.1', '<% control %> is deprecated. Use <% with %> or <% loop %> instead.');
|
||||
return $this->ClosedBlock_Handle_Loop($res);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user