Merge pull request #8366 from Wikia/DAT-3194

Dat 3194 - for videos in infobox use link to file page instead of link to original image
This commit is contained in:
Nikodem 2015-09-09 17:24:39 +02:00
commit 9767ef0d50
2 changed files with 20 additions and 4 deletions

View file

@ -110,8 +110,14 @@ class NodeImage extends Node {
* @return array
*/
private function videoDataDecorator( $data, $file ) {
$data['isVideo'] = true;
$data['duration'] = WikiaFileHelper::formatDuration( $file->getMetadataDuration());
$title = $file->getTitle();
if ( $title ) {
$data[ 'url' ] = $title->getFullURL();
}
$data[ 'isVideo' ] = true;
$data[ 'duration' ] = WikiaFileHelper::formatDuration( $file->getMetadataDuration());
return $data;
}

View file

@ -112,12 +112,12 @@ class NodeImageTest extends WikiaBaseTest {
'<image source="img" />',
[ 'img' => 'test.jpg' ],
[
'url' => '',
'url' => 'http://test.url',
'name' => 'Test.jpg',
'key' => 'Test.jpg',
'alt' => null,
'caption' => null,
'ref' => 0,
'ref' => null,
'isVideo' => true,
'duration' => '00:10'
]
@ -138,4 +138,14 @@ class FileMock {
public function getUrl() {
return '';
}
public function getTitle() {
return new TitleMock();
}
}
class TitleMock {
public function getFullURL() {
return 'http://test.url';
}
}