Top story photo template variables, with i18n, help and tests.
This commit is contained in:
parent
4768a8687e
commit
c28c7771c3
4 changed files with 116 additions and 17 deletions
|
|
@ -166,6 +166,22 @@ sub viewTemplateVariables {
|
|||
$var->{topStoryUrl} = $session->url->append($self->getUrl, 'func=viewStory;assetId='.$topStoryData->{assetId}),
|
||||
$var->{topStoryCreationDate} = $topStory->get('creationDate');
|
||||
##TODO: Photo variables
|
||||
my $photoData = $topStory->getPhotoData;
|
||||
PHOTO: foreach my $photo (@{ $photoData }) {
|
||||
next PHOTO unless $photo->{storageId};
|
||||
my $storage = WebGUI::Storage->get($session, $photo->{storageId});
|
||||
my $file = $storage->getFiles->[0];
|
||||
warn $storage->getId;
|
||||
next PHOTO unless $file;
|
||||
my $imageUrl = $storage->getUrl($file);
|
||||
$var->{topStoryImageUrl} = $imageUrl;
|
||||
$var->{topStoryImageCaption} = $photo->{caption};
|
||||
$var->{topStoryImageByline} = $photo->{byLine};
|
||||
$var->{topStoryImageAlt} = $photo->{alt};
|
||||
$var->{topStoryImageTitle} = $photo->{title};
|
||||
$var->{topStoryImageLink} = $photo->{url};
|
||||
last PHOTO;
|
||||
}
|
||||
}
|
||||
$var->{standAlone} = $self->{_standAlone};
|
||||
$var->{rssUrl} = $self->getUrl('func=viewRss');
|
||||
|
|
|
|||
|
|
@ -27,12 +27,18 @@ our $HELP = {
|
|||
{ name => 'creationDate' },
|
||||
],
|
||||
},
|
||||
{ name => 'topStoryTitle' },
|
||||
{ name => 'topStorySubtitle' },
|
||||
{ name => 'topStoryUrl' },
|
||||
{ name => 'topStoryTitle' },
|
||||
{ name => 'topStorySubtitle' },
|
||||
{ name => 'topStoryUrl' },
|
||||
{ name => 'topStoryCreationDate' },
|
||||
{ name => 'rssUrl' },
|
||||
{ name => 'atomUrl' },
|
||||
{ name => 'topStoryImageUrl' },
|
||||
{ name => 'topStoryImageCaption' },
|
||||
{ name => 'topStoryImageByline' },
|
||||
{ name => 'topStoryImageAlt' },
|
||||
{ name => 'topStoryImageTitle' },
|
||||
{ name => 'topStoryImageLink' },
|
||||
{ name => 'rssUrl' },
|
||||
{ name => 'atomUrl' },
|
||||
],
|
||||
related => []
|
||||
},
|
||||
|
|
|
|||
|
|
@ -105,6 +105,42 @@ our $I18N = {
|
|||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'topStoryImageCaption' => {
|
||||
message => q|The Caption of the first photo for the top story, if it exists.|,
|
||||
context => q|Template variable.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'topStoryImageByline' => {
|
||||
message => q|The Byline of the first photo for the top story, if it exists.|,
|
||||
context => q|Template variable.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'topStoryImageAlt' => {
|
||||
message => q|The alternate image text for the first photo for the top story, if it exists.|,
|
||||
context => q|Template variable.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'topStoryImageTitle' => {
|
||||
message => q|The image title for the first photo for the top story, if it exists.|,
|
||||
context => q|Template variable.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'topStoryImageLink' => {
|
||||
message => q|The link for the first photo for the top story, if it exists.|,
|
||||
context => q|Template variable.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'topStoryImageUrl' => {
|
||||
message => q|The URL to the first photo for the top story, if it exists.|,
|
||||
context => q|Template variable.|,
|
||||
lastUpdated => 0,
|
||||
},
|
||||
|
||||
'standAlone' => {
|
||||
message => q|This variable will be true if the Story Topic is being viewed directly, by its URL. Otherwise, if it is viewed as part of a Page Layout or other Container, it will be false.|,
|
||||
context => q|Template variable.|,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue