mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
update template docs, move deprecation to 5.0, capitalise Is
This commit is contained in:
parent
2e0e04f701
commit
7c95237e8d
@ -358,6 +358,8 @@ iteration.
|
|||||||
* `$Even`, `$Odd`: Returns boolean, handy for zebra striping.
|
* `$Even`, `$Odd`: Returns boolean, handy for zebra striping.
|
||||||
* `$EvenOdd`: Returns a string, either 'even' or 'odd'. Useful for CSS classes.
|
* `$EvenOdd`: Returns a string, either 'even' or 'odd'. Useful for CSS classes.
|
||||||
* `$First`, `$Last`, `$Middle`: Booleans about the position in the list.
|
* `$First`, `$Last`, `$Middle`: Booleans about the position in the list.
|
||||||
|
* Note: as of CMS 4.7.0 `$IsFirst` and `$IsLast` will be preferred. The original
|
||||||
|
syntax will continue to work, but will be deprecated in a future release.
|
||||||
* `$FirstLast`: Returns a string, "first", "last", "first last" (if both), or "". Useful for CSS classes.
|
* `$FirstLast`: Returns a string, "first", "last", "first last" (if both), or "". Useful for CSS classes.
|
||||||
* `$Pos`: The current position in the list (integer).
|
* `$Pos`: The current position in the list (integer).
|
||||||
Will start at 1, but can take a starting index as a parameter.
|
Will start at 1, but can take a starting index as a parameter.
|
||||||
|
@ -26,8 +26,8 @@ class SSViewer_BasicIteratorSupport implements TemplateIteratorProvider
|
|||||||
public static function get_template_iterator_variables()
|
public static function get_template_iterator_variables()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'isFirst',
|
'IsFirst',
|
||||||
'isLast',
|
'IsLast',
|
||||||
'First',
|
'First',
|
||||||
'Last',
|
'Last',
|
||||||
'FirstLast',
|
'FirstLast',
|
||||||
@ -61,19 +61,19 @@ class SSViewer_BasicIteratorSupport implements TemplateIteratorProvider
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isFirst()
|
public function IsFirst()
|
||||||
{
|
{
|
||||||
return $this->iteratorPos == 0;
|
return $this->iteratorPos == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated 4.7.0 Use isFirst() to avoid clashes with SS_Lists
|
* @deprecated 5.0 Use IsFirst() to avoid clashes with SS_Lists
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function First()
|
public function First()
|
||||||
{
|
{
|
||||||
Deprecation::notice('4.7.0', 'Use isFirst() to avoid clashes with SS_Lists');
|
Deprecation::notice('5.0', 'Use IsFirst() to avoid clashes with SS_Lists');
|
||||||
return $this->isFirst();
|
return $this->IsFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,19 +81,19 @@ class SSViewer_BasicIteratorSupport implements TemplateIteratorProvider
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isLast()
|
public function IsLast()
|
||||||
{
|
{
|
||||||
return $this->iteratorPos == $this->iteratorTotalItems - 1;
|
return $this->iteratorPos == $this->iteratorTotalItems - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated 4.7.0 Use isLast() to avoid clashes with SS_Lists
|
* @deprecated 5.0 Use IsLast() to avoid clashes with SS_Lists
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function Last()
|
public function Last()
|
||||||
{
|
{
|
||||||
Deprecation::notice('4.7.0', 'Use isLast() to avoid clashes with SS_Lists');
|
Deprecation::notice('5.0', 'Use IsLast() to avoid clashes with SS_Lists');
|
||||||
return $this->isLast();
|
return $this->IsLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -103,13 +103,13 @@ class SSViewer_BasicIteratorSupport implements TemplateIteratorProvider
|
|||||||
*/
|
*/
|
||||||
public function FirstLast()
|
public function FirstLast()
|
||||||
{
|
{
|
||||||
if ($this->isFirst() && $this->isLast()) {
|
if ($this->IsFirst() && $this->IsLast()) {
|
||||||
return 'first last';
|
return 'first last';
|
||||||
}
|
}
|
||||||
if ($this->isFirst()) {
|
if ($this->IsFirst()) {
|
||||||
return 'first';
|
return 'first';
|
||||||
}
|
}
|
||||||
if ($this->isLast()) {
|
if ($this->IsLast()) {
|
||||||
return 'last';
|
return 'last';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -122,7 +122,7 @@ class SSViewer_BasicIteratorSupport implements TemplateIteratorProvider
|
|||||||
*/
|
*/
|
||||||
public function Middle()
|
public function Middle()
|
||||||
{
|
{
|
||||||
return !$this->isFirst() && !$this->isLast();
|
return !$this->IsFirst() && !$this->IsLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user