mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Removing view logic and adding translation
This commit is contained in:
parent
947f65241f
commit
9e6e5b0d25
@ -371,7 +371,8 @@ class BlogPost extends Page {
|
||||
foreach($authors as $author) {
|
||||
$item = new ArrayData(array(
|
||||
'Name' => $author->Name,
|
||||
'Join' => '',
|
||||
'IsAndJoin' => false,
|
||||
'IsCommaJoin' => false,
|
||||
'URL' => '',
|
||||
));
|
||||
|
||||
@ -398,7 +399,8 @@ class BlogPost extends Page {
|
||||
foreach($authors as $author) {
|
||||
$item = new ArrayData(array(
|
||||
'Name' => $author,
|
||||
'Join' => '',
|
||||
'IsAndJoin' => false,
|
||||
'IsCommaJoin' => false,
|
||||
'URL' => ''
|
||||
));
|
||||
|
||||
@ -419,17 +421,18 @@ class BlogPost extends Page {
|
||||
$count = count($items);
|
||||
|
||||
for($i = 0; $i < $count; $i++) {
|
||||
if($count === 2 && $i > 0) {
|
||||
$items[$i]->Join = ' and ';
|
||||
if($count === 2 && $i === 1) {
|
||||
$items[$i]->IsAndJoin = true;
|
||||
}
|
||||
|
||||
if($count > 2) {
|
||||
if($i > 0) {
|
||||
$items[$i]->Join = ', ';
|
||||
$items[$i]->IsCommaJoin = true;
|
||||
}
|
||||
|
||||
if($i + 1 === $count) {
|
||||
$items[$i]->Join = ' and ';
|
||||
$items[$i]->IsCommaJoin = false;
|
||||
$items[$i]->IsAndJoin = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,6 @@
|
||||
|
||||
<% if $Credits %>
|
||||
<%t Blog.By "by" %>
|
||||
<% loop $Credits %><% if $URL %>$Join<a href="$URL">$Name.XML</a><% else %>$Join$Name.XML<% end_if %><% end_loop %>
|
||||
<% loop $Credits %><% if $URL %><% if $IsAndJoin %><%t Blog.Join.And " and " %><% end_if %><% if $IsCommaJoin %><%t Blog.Join.Comma ", " %><% end_if %><a href="$URL">$Name.XML</a><% else %><% if $IsAndJoin %><%t Blog.Join.And " and " %><% end_if %><% if $IsCommaJoin %><%t Blog.Join.Comma ", " %><% end_if %>$Name.XML<% end_if %><% end_loop %>
|
||||
<% end_if %>
|
||||
</p>
|
||||
|
Loading…
Reference in New Issue
Block a user